]> git.lizzy.rs Git - nhentai.git/commitdiff
Fix invalid filenames on Windows
authorFuzi Fuz <5782690+fuchs2711@users.noreply.github.com>
Sat, 18 Jul 2020 13:19:41 +0000 (15:19 +0200)
committerFuzi Fuz <5782690+fuchs2711@users.noreply.github.com>
Sat, 18 Jul 2020 13:19:41 +0000 (15:19 +0200)
nhentai/utils.py

index caa925b5982c794e11c5c240d6535f9b383ab245..f9ae77644e40aa978fae65ab9f3c74571c55c8f1 100644 (file)
@@ -233,6 +233,10 @@ and append a file extension like '.txt', so I avoid the potential of using
 an invalid filename.
 
 """
+    if sys.platform.startswith('win32'):
+        invalid_chars = '\/:*?"<>|.'
+        for char in invalid_chars:
+            s = s.replace(char, '_')
     return s
 
     # maybe you can use `--format` to select a suitable filename