mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Fix file name sanitizing
This commit is contained in:
parent
67bbc00d87
commit
8bb2c9c750
4 changed files with 23 additions and 19 deletions
|
|
@ -50,12 +50,5 @@ pub fn free_file(mut path: PathBuf) -> PathBuf {
|
|||
|
||||
path.set_file_name(format!("{} ({}).{}", filename, i, ext))
|
||||
}
|
||||
sanitize_file(path)
|
||||
}
|
||||
|
||||
/// Sanitizes the given path to not contain any invalid file character.
|
||||
pub fn sanitize_file(path: PathBuf) -> PathBuf {
|
||||
path.with_file_name(sanitize_filename::sanitize(
|
||||
path.file_name().unwrap().to_string_lossy(),
|
||||
))
|
||||
path
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue