Normalize filenames to Unicode Normal Form D before sanitisation
This commit is contained in:
parent
3449ea1076
commit
e95590ef07
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1416,6 +1416,7 @@ dependencies = [
|
|||
"thiserror",
|
||||
"time",
|
||||
"tokio",
|
||||
"unicode-normalization",
|
||||
"zip",
|
||||
]
|
||||
|
||||
|
|
|
@ -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"
|
|
@ -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::<String>()),
|
||||
size,
|
||||
modtime,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue