Remove leading and trailing whitespaces from output file

This commit is contained in:
bytedream 2023-11-06 21:20:43 +01:00
parent e5d9c27af7
commit f31437fba2

View file

@ -96,7 +96,7 @@ lazy_static::lazy_static! {
/// is based of the implementation of the
/// [`sanitize-filename`](https://crates.io/crates/sanitize-filename) crate.
pub fn sanitize<S: AsRef<str>>(path: S, include_path_separator: bool) -> String {
let path = Cow::from(path.as_ref());
let path = Cow::from(path.as_ref().trim());
let path = ILLEGAL_RE.replace_all(&path, "");
let path = CONTROL_RE.replace_all(&path, "");