Skip to content

Commit e59ea32

Browse files
metamejoepio
authored andcommitted
check bucket exists before unwrap
1 parent 68f4fbf commit e59ea32

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/src/files.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ pub async fn s3_upload_object(
5454
file_path: &PathBuf,
5555
) -> AtomicServerResult<()> {
5656
let mut builder = S3::default();
57-
builder.bucket(appstate.config.opts.s3_bucket.as_ref().unwrap().as_str());
57+
let bucket = appstate
58+
.config
59+
.opts
60+
.s3_bucket
61+
.as_ref()
62+
.ok_or("uploading to s3 but no s3 bucket configured")?;
63+
builder.bucket(bucket);
5864
appstate
5965
.config
6066
.opts

0 commit comments

Comments
 (0)