improve formatting

This commit is contained in:
Alex Auvolat 2023-05-15 12:35:39 +02:00
parent 3f93212424
commit 61e65a55ad
3 changed files with 4 additions and 4 deletions

View file

@ -369,6 +369,7 @@ pub struct S3Config {
pub hostname: String, pub hostname: String,
// may be useful when using self hosted s3. Won't work with recent AWS buckets // may be useful when using self hosted s3. Won't work with recent AWS buckets
pub path_style: bool, pub path_style: bool,
// http or https
pub protocol: String, pub protocol: String,
// download directly from s3 to user, wihout going through Plume. Require public read on bucket // download directly from s3 to user, wihout going through Plume. Require public read on bucket

View file

@ -108,7 +108,6 @@ fn save_uploaded_file(file: &SavedField) -> Result<Option<String>, plume_models:
Some(ext.to_lowercase()) Some(ext.to_lowercase())
} }
}) })
.map(|ext| format!(".{}", ext))
}) })
.unwrap_or_default(); .unwrap_or_default();
@ -120,7 +119,7 @@ fn save_uploaded_file(file: &SavedField) -> Result<Option<String>, plume_models:
{ {
use std::borrow::Cow; use std::borrow::Cow;
let dest = format!("static/media/{}{}", GUID::rand(), ext); let dest = format!("static/media/{}.{}", GUID::rand(), ext);
let bytes = match file.data { let bytes = match file.data {
SavedData::Bytes(ref bytes) => Cow::from(bytes), SavedData::Bytes(ref bytes) => Cow::from(bytes),
@ -143,7 +142,7 @@ fn save_uploaded_file(file: &SavedField) -> Result<Option<String>, plume_models:
Ok(Some(dest)) Ok(Some(dest))
} }
} else { } else {
let dest = format!("{}/{}{}", CONFIG.media_directory, GUID::rand(), ext); let dest = format!("{}/{}.{}", CONFIG.media_directory, GUID::rand(), ext);
match file.data { match file.data {
SavedData::Bytes(ref bytes) => { SavedData::Bytes(ref bytes) => {