Switch to sanitize-filename-reader-friendly

One advantage is that it does not depend on any crates, so there is a
higher chance of dropping regex crate eventually.
This commit is contained in:
Alexander Krotov
2020-06-23 02:28:35 +03:00
committed by link2xt
parent 07236efc45
commit 93797bc82f
3 changed files with 6 additions and 15 deletions

View File

@@ -320,13 +320,8 @@ impl<'a> BlobObject<'a> {
break;
}
}
let opts = sanitize_filename::Options {
truncate: true,
windows: true,
replacement: "",
};
let clean = sanitize_filename::sanitize_with_options(name, opts);
let clean = sanitize_filename_reader_friendly::sanitize(&name);
let mut iter = clean.splitn(2, '.');
let stem: String = iter.next().unwrap_or_default().chars().take(64).collect();
let ext: String = iter.next().unwrap_or_default().chars().take(32).collect();