Skip to content

Fix: Normalize macro route path to ensure compatibility with Windows#11

Open
bartleboeuf wants to merge 5 commits intoM4SS-Code:mainfrom
bartleboeuf:fix/windows-path
Open

Fix: Normalize macro route path to ensure compatibility with Windows#11
bartleboeuf wants to merge 5 commits intoM4SS-Code:mainfrom
bartleboeuf:fix/windows-path

Conversation

@bartleboeuf
Copy link

Issue description :
The macro was generating route paths from filesystem paths without normalizing separators/leading slash on Windows, so Axum received paths like \foo and panicked.

Fixes :

  • Updated EmbeddedFileInfo path handling to always normalize generated web routes via a helper.
  • In route generation, relative paths are now converted to web-safe paths (backslashes --> /, ensure leading /) .
  • strip_html_ext logic was working on absolute/path-string prefixes, which broke on Windows separator differences and could generate wrong routes. A quick rework of the helper is done.

All Unit tests are now good on Linux and Windows. (i was not able to test on Mac).

@bartleboeuf
Copy link
Author

#10

@paolobarbolini paolobarbolini linked an issue Mar 3, 2026 that may be closed by this pull request
bart.leboeuf and others added 2 commits March 3, 2026 20:07
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.

Static serving broken in Windows

3 participants