From 320f36c264db7021a53b83e3e2477c9fecaa1c8e Mon Sep 17 00:00:00 2001 From: Fuzi Fuz <5782690+fuchs2711@users.noreply.github.com> Date: Sat, 18 Jul 2020 15:19:41 +0200 Subject: [PATCH] Fix invalid filenames on Windows --- nhentai/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nhentai/utils.py b/nhentai/utils.py index caa925b..f9ae776 100644 --- a/nhentai/utils.py +++ b/nhentai/utils.py @@ -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