Update S3 features and make S3 support optional

This commit is contained in:
Alex Auvolat
2023-05-12 12:35:11 +02:00
parent 10e06737cf
commit 1cb9459a23
5 changed files with 71 additions and 53 deletions
+5 -2
View File
@@ -170,9 +170,12 @@ impl Media {
pub fn delete(&self, conn: &Connection) -> Result<()> {
if !self.is_remote {
if let Some(config) = &CONFIG.s3 {
config.get_bucket()
if CONFIG.s3.is_some() {
#[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())?;
}