Mola-maker opened a new issue, #9056:
URL: https://github.com/apache/opendal/issues/9056
### OpenDAL version or commit
main (57f8b75)
### Affected service or component
integrations/object_store (`OpendalStore`)
### Describe the bug
`OpendalStore` percent-decodes an `object_store::path::Path` before using it
as an OpenDAL path. object_store encodes a `/` that sits inside a single path
part as `%2F`. Decoding turns that part into two directory levels. As a result,
two **different** object_store paths address the **same** OpenDAL object:
- `Path::from_iter(["a", "b/c", "foo.file"])`, raw `a/b%2Fc/foo.file`
- `Path::from("a/b/c/foo.file")`
Writing one silently overwrites the other. Listing returns the wrong path.
Deleting one deletes the other.
object_store's own conformance suite catches this:
`object_store::integration::put_get_delete_list` fails against `OpendalStore`
(memory and fs) with
```
left: [Path { raw: "a/b/c/foo.file" }]
right: [Path { raw: "a/b%2Fc/foo.file" }]
```
### Steps to Reproduce
```rust
let with_slash_in_part = Path::from_iter(["a", "b/c", "foo.file"]);
let nested = Path::from("a/b/c/foo.file");
store.put(&with_slash_in_part, PutPayload::from_static(b"first")).await?;
store.put(&nested, PutPayload::from_static(b"second")).await?;
store.get(&with_slash_in_part).await?.bytes().await?; // which object?
store.list(Some(&Path::from("a")));
store.delete(&nested).await?;
store.get(&with_slash_in_part).await; // still there?
```
```
[object_store InMemory] get "a/b%2Fc/foo.file" -> "first"
[object_store InMemory] list a/ -> ["a/b%2Fc/foo.file", "a/b/c/foo.file"]
[object_store InMemory] after deleting "a/b/c/foo.file": "a/b%2Fc/foo.file"
is still exists
[OpendalStore(memory)] get "a/b%2Fc/foo.file" -> "second"
[OpendalStore(memory)] list a/ -> ["a/b/c/foo.file"]
[OpendalStore(memory)] after deleting "a/b/c/foo.file": "a/b%2Fc/foo.file"
is GONE
```
### Actual Behavior
Distinct paths share one object, so data is silently overwritten and deleted.
### Expected Behavior
Distinct paths never address the same object. OpenDAL uses `/` as its only
separator, so a path part that contains `/` cannot be represented. Operations
on such paths should fail with `Error::NotSupported` rather than touch another
object.
### Additional Context
The README's "Limitations" section does not mention this. Storing the raw
encoded form as the OpenDAL key would also avoid the aliasing, but it would
change the key of every existing object whose name contains `#`, `%` or other
encoded characters.
### Reproduction confirmation
- [x] I reproduced this issue against the affected component. For a
service-specific report, I used the actual service rather than only a mock,
emulator, or source-code analysis.
### Are you willing to submit a PR to fix this bug?
- [x] Yes, I would like to submit a PR.
--
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]