codxbrexx opened a new pull request, #7133:
URL: https://github.com/apache/opendal/pull/7133
# Which issue does this PR close?
Closes #6577.
# Rationale for this change
The existing
[normalize_path](cci:1://file:///home/codxbrexx/opendal/core/core/src/raw/path.rs:85:0-119:1)
implementation aggressively trimmed all leading and trailing whitespace. This
behavior incorrectly prevented access to valid files that intentionally contain
significant whitespace (e.g., `"file "`), causing path mismatch errors.
This change ensures that
[normalize_path](cci:1://file:///home/codxbrexx/opendal/core/core/src/raw/path.rs:85:0-119:1)
respects user-provided whitespace while maintaining other normalization
guarantees (like removing leading slashes).
# What changes are included in this PR?
- Removed `.trim()` from
[normalize_path](cci:1://file:///home/codxbrexx/opendal/core/core/src/raw/path.rs:85:0-119:1)
in
[core/src/raw/path.rs](cci:7://file:///home/codxbrexx/opendal/core/core/src/raw/path.rs:0:0-0:0)
to preserve whitespace semantics.
- Added unit test cases to verify that leading and trailing whitespace is
correctly preserved.
# Are there any user-facing changes?
Yes.
[normalize_path](cci:1://file:///home/codxbrexx/opendal/core/core/src/raw/path.rs:85:0-119:1)
now preserves whitespace in input paths.
- **Before:** [normalize_path(" foo
")](cci:1://file:///home/codxbrexx/opendal/core/core/src/raw/path.rs:85:0-119:1)
→ `"foo"`
- **After:** [normalize_path(" foo
")](cci:1://file:///home/codxbrexx/opendal/core/core/src/raw/path.rs:85:0-119:1)
→ `" foo "`
This ensures correct handling of filenames with whitespace for all backends.
# AI Usage Statement
None.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]