Mola-maker opened a new pull request, #9057:
URL: https://github.com/apache/opendal/pull/9057

   # Which issue does this PR close?
   
   Closes #9056.
   
   # Rationale for this change
   
   `OpendalStore` decodes `a/b%2Fc` to `a/b/c`, so two distinct object_store 
paths address the same OpenDAL object. A put to one silently overwrites the 
other, and deleting one deletes the other. OpenDAL uses `/` as its only 
separator, so a path part that contains `/` has no OpenDAL equivalent.
   
   # What changes are included in this PR?
   
   - Add `opendal_path`. It returns `NotSupported` when the raw path contains 
`%2F` or `%2f`, and otherwise decodes the path as before. `opendal_prefix` 
builds list prefixes on top of it.
   - Every user-path call site now uses these helpers: `put_opts`, 
`put_multipart_opts`, `get_opts` (and with it `head`), `get_ranges`, 
`delete_stream`, `list`, `list_with_offset`, `list_with_delimiter`, copy, 
rename, and `check_same_path`. `format_get_error` keeps the plain decode, 
because it only runs after `get` has validated the path.
   - Rename `test_get_ranges_directory_maps_to_not_found` to 
`test_get_ranges_encoded_slash_is_rejected`. The old test relied on `dir%2F` 
decoding to `dir/`. `test_get_ranges_directory_fs_maps_to_not_found` still 
covers mapping a directory to `NotFound`.
   - Add `test_path_part_with_slash_is_rejected_not_aliased`. It checks that 
put, get, head, delete, copy, list and `list_with_delimiter` reject the path 
and that the other object stays intact.
   - Document this limitation in the README.
   
   Why reject instead of keeping `%2F` in the key: storing only `%2F` literally 
would make `b%2Fc` collide with a real key `b%2Fc`. Storing the full raw form 
would change the key of every existing object whose name contains `#`, `%` and 
similar characters.
   
   Verification (Windows 11, rustc 1.99.1):
   
   - The new test fails on main and passes with this change.
   - `cargo test --no-fail-fast` in `integrations/object_store`:
     - lib: 87 passed and 1 failed. The failure is 
`test_directories_return_not_found_on_head_and_get`, which asserts object_store 
`LocalFileSystem` behavior and fails the same way on main on Windows.
     - `tests/backends`: 7 passed.
     - `tests/behavior`: 5 passed.
   - `cargo clippy --all-targets -- -D warnings`: clean on Windows. I could not 
run the Linux cross-target clippy here, because aws-lc-sys needs a C 
cross-toolchain.
   - Repro from the issue: the aliased put, get, delete and list now return 
`NotSupported`, and the other object is untouched.
   
   # Are there any user-facing changes?
   
   Yes. Paths whose parts contain `/`, written as `%2F`, now return 
`Error::NotSupported`. Before, they silently addressed a different object.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: Claude Code
   - Model: Anthropic Claude
   - Effort: default
   - Role: Found the bug by running object_store's own `integration` 
conformance suite against `OpendalStore`, reproduced the data aliasing, wrote 
the fix, tests and docs, and ran the checks above. A separate review pass 
checked every call site, the round trip of listed paths and why the mapping 
cannot be bijective.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to