Skip to content

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

Merged
paolobarbolini merged 5 commits into
M4SS-Code:mainfrom
bartleboeuf:fix/windows-path
Mar 20, 2026
Merged

Fix: Normalize macro route path to ensure compatibility with Windows#11
paolobarbolini merged 5 commits into
M4SS-Code:mainfrom
bartleboeuf:fix/windows-path

Conversation

@bartleboeuf
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

#10

Comment thread static-serve-macro/src/lib.rs Outdated
@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
Comment thread static-serve-macro/src/lib.rs Outdated
Comment thread static-serve-macro/src/lib.rs Outdated
Comment thread static-serve-macro/src/lib.rs
@pacman82
Copy link
Copy Markdown
Contributor

Anything I could help with to move this forward?

Copy link
Copy Markdown
Member

@paolobarbolini paolobarbolini left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. A few more improvement ideas around this area of the code came up while reviewing this PR, put we won't make you wait for those to land first. LGTM.

@paolobarbolini paolobarbolini merged commit dc6b0a1 into M4SS-Code:main Mar 20, 2026
7 checks passed
@pacman82
Copy link
Copy Markdown
Contributor

@paolobarbolini No need to apologize. Thanks for the great work. Looking forward to the release and the other improvements. 🎉

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