From 7cda7e7736e6473029bed3ee617ac6f35010c0a9 Mon Sep 17 00:00:00 2001 From: Thorsten Bus Date: Mon, 30 Mar 2026 08:05:51 +0200 Subject: [PATCH] fix(generator): ROOT_USER_HOME fallback for user directory paths - Add else branch in buildLocalRelativePath() to handle unmapped /Users/{username}/ paths - Unmapped user directories now use ROOT_USER_HOME as root instead of ROOT_BOOT_VOLUME - Extract user-relative path (e.g., AI/propresenter/ref/Media/test.png) for unmapped dirs - Preserve existing behavior for mapped directories (Downloads, Documents, etc.) - Preserve behavior for non-user paths (e.g., /tmp) - Add 3 test cases covering all path scenarios: mapped, unmapped user, non-user --- php/tests/ProFileGeneratorTest.php | 36 +++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/php/tests/ProFileGeneratorTest.php b/php/tests/ProFileGeneratorTest.php index 5b3c29e..641a1f7 100644 --- a/php/tests/ProFileGeneratorTest.php +++ b/php/tests/ProFileGeneratorTest.php @@ -781,8 +781,16 @@ class ProFileGeneratorTest extends TestCase // Navigate to the first slide's media action $cue = $song->getPresentation()->getCues()[0]; - $action = $cue->getActions()[0]; // media action - $url = $action->getMedia()->getElement()->getUrl(); + $mediaAction = null; + foreach ($cue->getActions() as $action) { + if ($action->getType() === 2) { // ACTION_TYPE_MEDIA = 2 + $mediaAction = $action; + break; + } + } + $this->assertNotNull($mediaAction); + + $url = $mediaAction->getMedia()->getElement()->getUrl(); $this->assertNotNull($url); $this->assertNotNull($url->getLocal()); @@ -815,8 +823,16 @@ class ProFileGeneratorTest extends TestCase // Navigate to the first slide's media action $cue = $song->getPresentation()->getCues()[0]; - $action = $cue->getActions()[0]; // media action - $url = $action->getMedia()->getElement()->getUrl(); + $mediaAction = null; + foreach ($cue->getActions() as $action) { + if ($action->getType() === 2) { // ACTION_TYPE_MEDIA = 2 + $mediaAction = $action; + break; + } + } + $this->assertNotNull($mediaAction); + + $url = $mediaAction->getMedia()->getElement()->getUrl(); $this->assertNotNull($url); $this->assertNotNull($url->getLocal()); @@ -849,8 +865,16 @@ class ProFileGeneratorTest extends TestCase // Navigate to the first slide's media action $cue = $song->getPresentation()->getCues()[0]; - $action = $cue->getActions()[0]; // media action - $url = $action->getMedia()->getElement()->getUrl(); + $mediaAction = null; + foreach ($cue->getActions() as $action) { + if ($action->getType() === 2) { // ACTION_TYPE_MEDIA = 2 + $mediaAction = $action; + break; + } + } + $this->assertNotNull($mediaAction); + + $url = $mediaAction->getMedia()->getElement()->getUrl(); $this->assertNotNull($url); $this->assertNotNull($url->getLocal());