diff --git a/src/client_server/media.rs b/src/client_server/media.rs
index 14ab6db06eb7bba198ddf3850f641fd0bd274236..0b1fbd7bcf6cbaec264552d29a49217223bb5be9 100644
--- a/src/client_server/media.rs
+++ b/src/client_server/media.rs
@@ -36,17 +36,20 @@ pub async fn create_content_route(
         db.globals.server_name(),
         utils::random_string(MXC_LENGTH)
     );
-    db.media.create(
-        mxc.clone(),
-        &db.globals,
-        &body
-            .filename
-            .as_ref()
-            .map(|filename| "inline; filename=".to_owned() + filename)
-            .as_deref(),
-        &body.content_type.as_deref(),
-        &body.file,
-    ).await?;
+
+    db.media
+        .create(
+            mxc.clone(),
+            &db.globals,
+            &body
+                .filename
+                .as_ref()
+                .map(|filename| "inline; filename=".to_owned() + filename)
+                .as_deref(),
+            &body.content_type.as_deref(),
+            &body.file,
+        )
+        .await?;
 
     db.flush().await?;
 
@@ -94,13 +97,15 @@ pub async fn get_content_route(
             )
             .await?;
 
-        db.media.create(
-            mxc,
-            &db.globals,
-            &get_content_response.content_disposition.as_deref(),
-            &get_content_response.content_type.as_deref(),
-            &get_content_response.file,
-        ).await?;
+        db.media
+            .create(
+                mxc,
+                &db.globals,
+                &get_content_response.content_disposition.as_deref(),
+                &get_content_response.content_type.as_deref(),
+                &get_content_response.file,
+            )
+            .await?;
 
         Ok(get_content_response.into())
     } else {
@@ -121,16 +126,20 @@ pub async fn get_content_thumbnail_route(
 
     if let Some(FileMeta {
         content_type, file, ..
-    }) = db.media.get_thumbnail(
-        mxc.clone(),
-        &db.globals,
-        body.width
-            .try_into()
-            .map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Width is invalid."))?,
-        body.height
-            .try_into()
-            .map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Width is invalid."))?,
-    ).await? {
+    }) = db
+        .media
+        .get_thumbnail(
+            mxc.clone(),
+            &db.globals,
+            body.width
+                .try_into()
+                .map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Width is invalid."))?,
+            body.height
+                .try_into()
+                .map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Width is invalid."))?,
+        )
+        .await?
+    {
         Ok(get_content_thumbnail::Response { file, content_type }.into())
     } else if &*body.server_name != db.globals.server_name() && body.allow_remote {
         let get_thumbnail_response = db
@@ -149,15 +158,17 @@ pub async fn get_content_thumbnail_route(
             )
             .await?;
 
-        db.media.upload_thumbnail(
-            mxc,
-            &db.globals,
-            &None,
-            &get_thumbnail_response.content_type,
-            body.width.try_into().expect("all UInts are valid u32s"),
-            body.height.try_into().expect("all UInts are valid u32s"),
-            &get_thumbnail_response.file,
-        ).await?;
+        db.media
+            .upload_thumbnail(
+                mxc,
+                &db.globals,
+                &None,
+                &get_thumbnail_response.content_type,
+                body.width.try_into().expect("all UInts are valid u32s"),
+                body.height.try_into().expect("all UInts are valid u32s"),
+                &get_thumbnail_response.file,
+            )
+            .await?;
 
         Ok(get_thumbnail_response.into())
     } else {
diff --git a/src/database/globals.rs b/src/database/globals.rs
index 1ca64de193979d3f8805ff5b95eb691e9b6493ce..de97578bfe1f97eb6ca57d0a4bf9c5058dc4c2c2 100644
--- a/src/database/globals.rs
+++ b/src/database/globals.rs
@@ -5,7 +5,12 @@
     EventId, MilliSecondsSinceUnixEpoch, ServerName, ServerSigningKeyId,
 };
 use rustls::{ServerCertVerifier, WebPKIVerifier};
-use std::{collections::{BTreeMap, HashMap}, path::{PathBuf}, sync::{Arc, RwLock}, time::{Duration, Instant}};
+use std::{
+    collections::{BTreeMap, HashMap},
+    path::PathBuf,
+    sync::{Arc, RwLock},
+    time::{Duration, Instant},
+};
 use tokio::sync::Semaphore;
 use trust_dns_resolver::TokioAsyncResolver;
 
@@ -279,7 +284,7 @@ pub fn get_media_folder(&self) -> PathBuf {
         r
     }
 
-    pub fn get_media_file(&self, key: &Vec<u8>) -> PathBuf {
+    pub fn get_media_file(&self, key: &[u8]) -> PathBuf {
         let mut r = PathBuf::new();
         r.push(self.config.database_path.clone());
         r.push("media");
diff --git a/src/database/media.rs b/src/database/media.rs
index 666a4943c65e7664d6e778addb8cc70375f4beaa..6fd142d3d3a1b60d7f16099481ba2b6ed2458d72 100644
--- a/src/database/media.rs
+++ b/src/database/media.rs
@@ -1,10 +1,14 @@
-use image::{imageops::FilterType, GenericImageView};
 use crate::database::globals::Globals;
+use image::{imageops::FilterType, GenericImageView};
 
+use super::abstraction::Tree;
 use crate::{utils, Error, Result};
 use std::{mem, sync::Arc};
-use super::abstraction::Tree;
-use tokio::{fs::{self, File}, io::AsyncWriteExt, io::AsyncReadExt};
+use tokio::{
+    fs::{self, File},
+    io::AsyncReadExt,
+    io::AsyncWriteExt,
+};
 
 pub struct FileMeta {
     pub content_disposition: Option<String>,
@@ -167,7 +171,13 @@ pub fn thumbnail_properties(&self, width: u32, height: u32) -> Option<(u32, u32,
     /// - Server creates the thumbnail and sends it to the user
     ///
     /// For width,height <= 96 the server uses another thumbnailing algorithm which crops the image afterwards.
-    pub async fn get_thumbnail(&self, mxc: String, globals: &Globals, width: u32, height: u32) -> Result<Option<FileMeta>> {
+    pub async fn get_thumbnail(
+        &self,
+        mxc: String,
+        globals: &Globals,
+        width: u32,
+        height: u32,
+    ) -> Result<Option<FileMeta>> {
         let (width, height, crop) = self
             .thumbnail_properties(width, height)
             .unwrap_or((0, 0, false)); // 0, 0 because that's the original file
@@ -225,7 +235,7 @@ pub async fn get_thumbnail(&self, mxc: String, globals: &Globals, width: u32, he
             let path = globals.get_media_file(&key.to_vec());
             let mut file = vec![];
             File::open(path).await?.read_to_end(&mut file).await?;
-            
+
             let mut parts = key.rsplit(|&b| b == 0xff);
 
             let content_type = parts
@@ -326,20 +336,20 @@ pub async fn get_thumbnail(&self, mxc: String, globals: &Globals, width: u32, he
                 fs::create_dir_all(path.parent().unwrap()).await?;
                 let mut f = File::create(path).await?;
                 f.write_all(&thumbnail_bytes).await?;
-        
+
                 self.mediaid_file.insert(&thumbnail_key, &[])?;
 
                 Ok(Some(FileMeta {
                     content_disposition,
                     content_type,
-                    file: thumbnail_bytes.to_vec()
+                    file: thumbnail_bytes.to_vec(),
                 }))
             } else {
                 // Couldn't parse file to generate thumbnail, send original
                 Ok(Some(FileMeta {
                     content_disposition,
                     content_type,
-                    file: file.to_vec()
+                    file: file.to_vec(),
                 }))
             }
         } else {