Skip to content

Commit

Permalink
improve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis211 committed May 15, 2023
1 parent 3f93212 commit 61e65a5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions plume-models/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/routes/medias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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),
Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]),
})
}
Expand Down

0 comments on commit 61e65a5

Please sign in to comment.