diff --git a/Cargo.lock b/Cargo.lock index fcc24fd..923982c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1416,6 +1416,7 @@ dependencies = [ "thiserror", "time", "tokio", + "unicode-normalization", "zip", ] diff --git a/Cargo.toml b/Cargo.toml index bbdd0ee..fa6bb37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,7 @@ serde_json = "1.0" thiserror = "1" time = "0.3.9" tokio = { version = "1.17.0", features = ["full"] } +unicode-normalization = "0.1.19" [dev-dependencies] zip = "0.6.2" \ No newline at end of file diff --git a/src/upload.rs b/src/upload.rs index 7191e5f..2c0c219 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -8,6 +8,7 @@ use log::{debug, error, info, trace}; use rand::distributions::{Alphanumeric, DistString}; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; +use unicode_normalization::UnicodeNormalization; use crate::store::{storage_dir, StoredFile, self}; @@ -90,7 +91,7 @@ pub struct UploadedFile { impl UploadedFile { fn new(name: &str, size: u64, modtime: OffsetDateTime) -> Self { Self { - name: sanitise_file_name::sanitise(name), + name: sanitise_file_name::sanitise(&name.nfd().collect::()), size, modtime, }