From 73fe2d6193fcc5f3ab9978587f6b2f59a299ddd3 Mon Sep 17 00:00:00 2001 From: 64Core Date: Thu, 9 Jun 2022 00:35:05 -0500 Subject: [PATCH] Fixes an issue with not properly handling games whose names ended in '...' relating to issue #57 --- itchiodl/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/itchiodl/utils.py b/itchiodl/utils.py index f700730..14d4d8f 100644 --- a/itchiodl/utils.py +++ b/itchiodl/utils.py @@ -1,7 +1,7 @@ import re import hashlib import requests - +import os.path class NoDownloadError(Exception): """No download found exception""" @@ -38,10 +38,10 @@ def download(url, path, name, file): def clean_path(path): """Cleans a path on windows""" - #if sys.platform in ["win32", "cygwin", "msys"]: - path_clean = re.sub(r"[\<\>\:\"\/\\\|\?\*]", "-", path) + path_clean = re.sub(r'[<>:"/\\|?*]', "-", path) + # This checks for strings that end in ... or similar, weird corner case that affects fewer than 0.1% of titles + path_clean = re.sub(r'(.)[.]\1+$', "-", path_clean) return path_clean - #return path def md5sum(path):