diff options
Diffstat (limited to 'src/media/storage')
-rw-r--r-- | src/media/storage/file.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/media/storage/file.rs b/src/media/storage/file.rs index 711b298..e432945 100644 --- a/src/media/storage/file.rs +++ b/src/media/storage/file.rs @@ -99,15 +99,15 @@ impl MediaStore for FileStore { tempfile.flush().await?; tempfile.into_inner().sync_all().await?; - let hash = hasher.finalize(); - debug!("Pending upload hash: {}", hex::encode(hash)); + let hash = data_encoding::HEXLOWER.encode(&hasher.finalize()); + debug!("Pending upload hash: {}", hash); let filename = format!( "{}/{}/{}/{}/{}", - hex::encode([hash[0]]), - hex::encode([hash[1]]), - hex::encode([hash[2]]), - hex::encode([hash[3]]), - hex::encode(&hash[4..32]) + &hash[0..2], + &hash[2..4], + &hash[4..6], + &hash[6..8], + &hash[8..] ); let domain_str = domain.to_string(); let filepath = self.base.join(domain_str.as_str()).join(&filename); @@ -115,7 +115,7 @@ impl MediaStore for FileStore { let metapath = self.base.join(domain_str.as_str()).join(&metafilename); let metatemppath = self.base.join(domain_str.as_str()).join(metafilename + ".tmp"); metadata.length = std::num::NonZeroUsize::new(length); - metadata.etag = Some(hex::encode(hash)); + metadata.etag = Some(hash); debug!("File path: {}, metadata: {}", filepath.display(), metapath.display()); { let parent = filepath.parent().unwrap(); |