-
Notifications
You must be signed in to change notification settings - Fork 759
fix: decode percent-encoded paths in get_file_path() #1072
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
Conversation
Paths containing spaces (e.g., macOS ~/Library/Application Support/) get percent-encoded when converted to URLs (%20 for spaces). This caused "Volume not found" errors when rustfs tried to access paths with their encoded form instead of the actual filesystem path. Changes: - get_file_path() now returns String and decodes percent-encoded chars - Updated endpoints.rs to handle the new String return type - Added test for paths with spaces This fixes the issue where rustfs data directories in paths with spaces would fail to be found.
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.
Pull request overview
This PR fixes a bug where paths containing spaces (or other characters that get percent-encoded when converted to URLs) caused "Volume not found" errors. The issue occurred because get_file_path() was returning the percent-encoded path string (e.g., Application%20Support) instead of decoding it back to the actual filesystem path (e.g., Application Support).
- Changed
get_file_path()to decode percent-encoded URLs before returning the path - Updated
endpoints.rsto handle the newStringreturn type instead of&str - Added test coverage for paths containing spaces
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/ecstore/src/disk/endpoint.rs | Modified get_file_path() to return String and decode percent-encoded characters using urlencoding::decode(); added test for paths with spaces |
| crates/ecstore/src/endpoints.rs | Updated HashMap types and references to work with String return type from get_file_path() instead of &str |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hey @jacoblyles , Could you please add some types? Thanks. |
- Add test_endpoint_percent_encoding_roundtrip to verify URL stores percent-encoded path and get_file_path() decodes it correctly - Add test_endpoint_with_various_special_characters to test paths with spaces, brackets, and hash characters
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.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hey @jacoblyles , Automated test failed. |
Looks like a flakey test unrelated to my changes. How to rerun? |
- Add debug logging when percent-decoding fails in get_file_path() - Use test path without URL fragment semantics (#) to avoid confusion
|
Hey @jacoblyles , Thank you for your contribution! We have merged the code. |
Type of Change
Related Issues
#1011
Summary of Changes
Paths containing spaces (e.g., macOS
~/Library/Application Support/) get percent-encoded when converted to URLs (%20for spaces). This caused "Volume not found" errors when rustfs tried to access paths with their encoded form instead of the actual filesystem path.Changes:
get_file_path()now returnsStringand decodes percent-encoded charsendpoints.rsto handle the newStringreturn typeChecklist
make pre-commitImpact
Additional Notes
This fixes the issue where rustfs data directories in paths with spaces would fail to be found.