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,
// may be useful when using self hosted s3. Won't work with recent AWS buckets
pub path_style: bool,
// http or https
pub protocol: String,
// 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())
}
})
.map(|ext| format!(".{}", ext))
})
.unwrap_or_default();
@ -120,7 +119,7 @@ fn save_uploaded_file(file: &SavedField) -> Result<Option<String>, plume_models:
{
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 {
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))
}
} else {
let dest = format!("{}/{}{}", CONFIG.media_directory, GUID::rand(), ext);
let dest = format!("{}/{}.{}", CONFIG.media_directory, GUID::rand(), ext);
match file.data {
SavedData::Bytes(ref bytes) => {

View file

@ -279,7 +279,7 @@ pub fn plume_media_files(file: PathBuf) -> Option<CachedFile> {
.unwrap_or(ContentType::Binary);
Some(CachedFile {
inner: FileKind::S3 ( data.to_vec(), ct),
inner: FileKind::S3(data.to_vec(), ct),
cache_control: CacheControl(vec![CacheDirective::MaxAge(60 * 60 * 24 * 30)]),
})
}