Update S3 features and make S3 support optional
This commit is contained in:
@@ -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())?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user