Skip to content

Replace \ with / in file names when packing#573

Open
madebyisaacr wants to merge 3 commits intomainfrom
always-use-forward-slash
Open

Replace \ with / in file names when packing#573
madebyisaacr wants to merge 3 commits intomainfrom
always-use-forward-slash

Conversation

@madebyisaacr
Copy link
Collaborator

@madebyisaacr madebyisaacr commented Feb 27, 2026

Description

This pull request updates framer-plugin-tools to replace \ with / in file names.

This plugin's CSS file has the name:
assets\index-DA6fbhnP.css

Which gets mapped to this when URL encoded:
assets%5Cindex-DA6fbhnP.css (link)

But the stylesheet in the index.html file references /assets/index-DA6fbhnP.css so the file doesn't load.

I have never seen this before today, so it's probably an unusual quirk of using Windows and having an abnormal build config or something like that.

Testing

  • Test packing a plugin with a file name including a \ and verify that when you unzip the plugin.zip file, it has a / in the file name

The way I tested on macOS is by opening the google-sheets plugin, moving the src/assets/hero.png file to the src/ folder and renaming it to "assets\hero.png" to simulate using a \ for directories like on Windows.

@madebyisaacr madebyisaacr marked this pull request as ready for review February 27, 2026 17:58
@madebyisaacr madebyisaacr requested a review from niekert February 27, 2026 17:58
zip.addFile(markerFileName, Buffer.from("true", "utf-8"))

// Normalize all entry paths to use forward slashes
for (const entry of zip.getEntries()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a test for this in lib.test.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test

@niekert
Copy link
Member

niekert commented Mar 2, 2026

moving the src/assets/hero.png file to the src/ folder and renaming it to "assets\hero.png" to simulate using a \ for directories like on Windows.

I'm not sure I understand. Do you name it assets\hero in the import? Thats a syntax error right>?

@madebyisaacr
Copy link
Collaborator Author

I'm not sure I understand. Do you name it assets\hero in the import? Thats a syntax error right?

Name it assets\hero in the file name. Windows uses \ instead of / for file directories and usually it handles converting to / when packing automatically, but apparently not always. Keep the forward slash in the import.

@madebyisaacr madebyisaacr requested a review from niekert March 3, 2026 17:28
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.

2 participants