rust-s3
rust-s3 copied to clipboard
bucket: ensure Bucket::exists() honours 'dangereous' config
trafficstars
The following fails on connections that have invalid SSL certificates. Other operations on the bucket succeed.
let bucket = Bucket::new("mybucket", region.clone(), credentials.clone())?
.set_dangereous_config(true, false)?
.with_path_style();
assert!(bucket.exists().unwrap()); // fails with
The existing exists() implementation creates a dummy_bucket and calls a static method to lookup the buckets and find ours. In doing so it discards most of the configuration in order to "" null out the bucket name.
I've forced the issue by duplicating the dummy_handle via clone(). There's probably a smarter way to do this though.
If the name = "" part isn't needed then clone() could be skipped altogether.