Skip to content

Fix: normalize absolute image paths in composition loading#409

Open
oiesc wants to merge 1 commit intoxvrh:masterfrom
oiesc:patch-1
Open

Fix: normalize absolute image paths in composition loading#409
oiesc wants to merge 1 commit intoxvrh:masterfrom
oiesc:patch-1

Conversation

@oiesc
Copy link
Copy Markdown

@oiesc oiesc commented Nov 6, 2025

This PR fixes an issue where image paths inside the composition could start with a leading slash (/), causing them not to match entries in the archive.

Expected: images/bg.png  
Got:      /images/bg.png

As a result, the image wasn’t found and failed to load.

We now check if the joined path is absolute using p.posix.isAbsolute(imagePath) and remove the leading slash when needed:

if (p.posix.isAbsolute(imagePath)) {
  imagePath = imagePath.substring(1);
}

This PR fixes an issue where image paths inside the composition could start with a leading slash (/), causing them not to match entries in the archive.

Expected: images/bg.png  
Got:      /images/bg.png

As a result, the image wasn’t found and failed to load.

We now check if the joined path is absolute using p.posix.isAbsolute(imagePath) and remove the leading slash when needed:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant