diff --git a/modules/images.py b/modules/images.py index 65f105829..1fb1813ee 100644 --- a/modules/images.py +++ b/modules/images.py @@ -318,10 +318,9 @@ max_filename_part_length = 128 def sanitize_filename_part(text, replace_spaces=True): if text is None: return None - + text = os.path.basename(text) if replace_spaces: text = text.replace(' ', '_') - text = text.translate({ord(x): '_' for x in invalid_filename_chars}) text = text.lstrip(invalid_filename_prefix)[:max_filename_part_length] text = text.rstrip(invalid_filename_postfix) diff --git a/setup.py b/setup.py index d78638723..d3af2834b 100644 --- a/setup.py +++ b/setup.py @@ -131,6 +131,8 @@ def git(arg: str, folder: str = None, ignore: bool = False): # update switch to main branch as head can get detached and update repository def update(folder): + if not os.path.exists(os.path.join(folder, '.git')): + return branch = git('branch', folder) if 'main' in branch: git('checkout main', folder)