Remove all leading dots and spaces

This commit is contained in:
Alex Ling
2021-09-09 00:13:58 +00:00
parent ccf558eaa7
commit 566cebfcdd
2 changed files with 2 additions and 2 deletions

View File

@@ -135,7 +135,7 @@ def sanitize_filename(str : String) : String
.gsub(/\s+/, " ")
.strip
.gsub(/\//, "_")
.gsub(/^\.+/, "")
.gsub(/^[\.\s]+/, "")
.gsub(/[\177\000-\031\\:\*\?\"<>\|]/, "")
sanitized.size > 0 ? sanitized : random_str
end