-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not unwrap when creating a bucket #82
Conversation
Thanks for the PR. We didn't expect that |
Codecov Report
@@ Coverage Diff @@
## main #82 +/- ##
==========================================
- Coverage 91.03% 90.23% -0.81%
==========================================
Files 29 29
Lines 1361 1372 +11
==========================================
- Hits 1239 1238 -1
- Misses 122 134 +12
|
Hey @paolobarbolini, Here is the exact code I ran to trigger this panic: use std::time::Duration;
use rusty_s3::actions::{CreateBucket, S3Action};
use rusty_s3::{Bucket, Credentials, UrlStyle};
#[test]
pub fn create_bucket() {
let mut buf = [0; 8];
getrandom::getrandom(&mut buf).expect("getrandom");
let name = "tamo".to_string();
let url = "http://localhost:9000".parse().unwrap();
let key = "minioadmin";
let secret = "minioadmin";
let region = "minio";
let bucket = Bucket::new(url, UrlStyle::VirtualHost, name, region).unwrap();
let credentials = Credentials::new(key, secret);
let action = CreateBucket::new(&bucket, &credentials);
let url = action.sign(Duration::from_secs(60));
ureq::put(dbg!(url.as_str())).call().unwrap();
} And here’s the logs:
So, from what I understand,
The URL is Also, the fix is to change the I’ll be honest, I’m a huge S3 noob, so I have no idea of what it means (I see it changes the URL, but I don't even know why I have the choice 😅). You can reproduce this issue easily on your side by updating the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix and the for posting the reproduction. I'll try merging and releasing over the weekend
Co-authored-by: Paolo Barbolini <paolo@paolo565.org>
Hey, while trying this amazing lib, I miss-typed my URL and got an unwrap from the lib; I guess it’s better to forward the error to the caller than panicking in the callee, right?