https://opendal.apache.org/ logo
Put object starts with `/`
# general
c
I don't know if this is addressed already, but here's my problem. I'm trying to upload an object to GCS using S3 compatible
Google Cloud Storage XML API
using Java bindings. The objectName starts with
/
. e.g.
/bill.pdf
. So far I have tried the following ways but couldn't get it to work: 1.
Copy code
Map<String, String> conf = new HashMap<>();
    // other conf <K,V> entries
    conf.put("bucket", "<bucket-name>");
    conf.put("root", "/");

    Operator op = Operator.of("s3", conf);
    op.write("bill.pdf", content).get();
2.
Copy code
Map<String, String> conf = new HashMap<>();
    // other conf <K,V> entries
    conf.put("bucket", "<bucket-name>");

    Operator op = Operator.of("s3", conf);
    op.write("/bill.pdf", content).get();
The URI generated is always
https://storage.googleapis.com/<bucket-name>/bill.pdf
. However, I want it to be
https://storage.googleapis.com/<bucket-name>//bill.pdf
. Any ideas how I can achieve this?
x
Hi, @cordcycle, opendal doesn't support upload objects that start with
/
.
OpenDAL will perform path normalization by removing the leading
/
in the path.
c
Thanks @Xuanwo for clarifying it. Shouldn't this be highlighted in the docs for bucket-type storages (correct me if already there)?
x
Correct, we need to make it clear in our public API.
All our public API are going though https://opendal.apache.org/docs/rust/opendal/raw/fn.normalize_path.html, so we might forgot to mention it in the public API
I have created an issue for this: https://github.com/apache/opendal/issues/4101