-
Notifications
You must be signed in to change notification settings - Fork 21
fix: resolve static paths correctly on Windows #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughPath normalization for Windows-style file separators is added to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes The changes are homogeneous (consistent pattern application across multiple code paths in a single file) and straightforward—replacing path separators and normalizing routes. Review focuses on verifying the normalization is applied uniformly across all affected branches and that no instances were missed. Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/index.ts (1)
84-96: LGTM! Path normalization correctly fixes Windows route registration.The normalization converts Windows backslashes to forward slashes before registering routes with Elysia, ensuring cross-platform compatibility. The logic correctly handles both the main route and the index.html fallback route.
Consider extracting the normalization logic into a helper function to reduce duplication (also appears at lines 185 and 231):
const normalizeRoutePath = (pathName: string) => pathName.replace(/\\/g, '/')Then use:
-const normalizedPath = pathName.replace(/\\/g, '/') +const normalizedPath = normalizeRoutePath(pathName)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/index.ts(5 hunks)
🔇 Additional comments (3)
src/index.ts (3)
185-213: LGTM! Normalization correctly applied to static file routes.The path normalization is properly integrated with the caching logic. Cache keys intentionally use
pathName(file system paths) while route registration usesnormalizedPath(URL paths), which is the correct approach.
223-240: LGTM! Bun HTML routes correctly use normalized paths.The normalization is consistently applied in the Bun HTML handling branch, matching the pattern used in the
alwaysStaticbranch.
249-249: LGTM! Minor formatting cleanup.The ternary expression formatting change is purely stylistic with no functional impact.
Summary by CodeRabbit
Bug Fixes
Style