mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Replace invalid characters in filenames (Windows only, fixes #3)
This commit is contained in:
parent
58078fc2cf
commit
6b1e6cb9a6
@ -1055,6 +1055,11 @@ impl URL {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
const INVALID: &'static [char] = &['/', '\\'];
|
||||
#[cfg(target_os = "windows")]
|
||||
const INVALID: &'static [char] = &['/', '\\', ':', '<', '>', '"', '|', '?', '*'];
|
||||
|
||||
fn file_escape(s: &str) -> String {
|
||||
s.replace('/', "-").replace('\\', "-")
|
||||
s.replace(INVALID, "-")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user