Add support for uploading media files to S3

This commit is contained in:
Alex Auvolat
2023-05-12 13:19:41 +02:00
parent 1cb9459a23
commit 24c008b0de
4 changed files with 86 additions and 40 deletions
+3 -2
View File
@@ -171,11 +171,12 @@ impl Media {
pub fn delete(&self, conn: &Connection) -> Result<()> {
if !self.is_remote {
if CONFIG.s3.is_some() {
#[cfg(not(feature="s3"))]
unreachable!();
#[cfg(feature = "s3")]
CONFIG.s3.as_ref().unwrap().get_bucket()
.delete_object_blocking(&self.file_path)?;
#[cfg(not(feature="s3"))]
unreachable!();
} else {
fs::remove_file(self.file_path.as_str())?;
}