mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
Escape illegal filename characters in Windows
This commit is contained in:
parent
f7b8e2d852
commit
b6a204f5bd
@ -139,9 +139,13 @@ module Rename
|
|||||||
post_process str
|
post_process str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Post-processes the generated file/folder name
|
||||||
|
# - Handles the rare case where the string is `..`
|
||||||
|
# - Removes trailing spaces and periods
|
||||||
|
# - Replace illegal characters with `_`
|
||||||
private def post_process(str)
|
private def post_process(str)
|
||||||
return "_" if str == ".."
|
return "_" if str == ".."
|
||||||
str.gsub "/", "_"
|
str.rstrip(" .").gsub /[\/?<>\\:*|"^]/, "_"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user