When cleaning file name remove question marks instead of replacing them with dashes

This commit is contained in:
hygienic-books 2022-03-23 23:39:32 +01:00
parent a3a375d142
commit e269a110a6

View File

@ -400,8 +400,11 @@ def get_safe_filename(
shorthand_uuid: str) -> str: shorthand_uuid: str) -> str:
"""https://stackoverflow.com/a/71199182""" """https://stackoverflow.com/a/71199182"""
log.debug(f"{shorthand_uuid} Removing question marks from file name ...")
clean_filename = re.sub(r"""[?]""", "", dirty_filename)
log.debug(f"{shorthand_uuid} Replacing unsafe characters in filename with dashes ...") log.debug(f"{shorthand_uuid} Replacing unsafe characters in filename with dashes ...")
clean_filename = re.sub(r"""[/\\?%*:|"<>\x7F\x00-\x1F]""", "-", dirty_filename) clean_filename = re.sub(r"""[/\\?%*:|"<>\x7F\x00-\x1F]""", "-", clean_filename)
log.debug(f"{shorthand_uuid} New filename: '{clean_filename}'") log.debug(f"{shorthand_uuid} New filename: '{clean_filename}'")
return clean_filename return clean_filename