From c40deb3631ee60a4951466091104ba08b64b03c4 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 28 Jan 2021 17:00:19 -0800 Subject: [PATCH] Disable remove_control_characters under path_badchars indefinitely. --- etiquette/helpers.py | 6 +++++- etiquette/objects.py | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/etiquette/helpers.py b/etiquette/helpers.py index 77490cf..77428b4 100644 --- a/etiquette/helpers.py +++ b/etiquette/helpers.py @@ -407,7 +407,11 @@ def remove_path_badchars(filepath, allowed=''): ''' badchars = stringtools.remove_characters(constants.FILENAME_BADCHARS, allowed) filepath = stringtools.remove_characters(filepath, badchars) - filepath = stringtools.remove_control_characters(filepath) + # Note: This is temporarily disabled until I can improve + # remove_control_characters. I want to avoid abusive / totally bogus names + # without breaking legitimate uses of control characters such as + # left-to-right marks which may appear in e.g. Arabic filenames. + # filepath = stringtools.remove_control_characters(filepath) filepath = filepath.replace('/', os.sep) filepath = filepath.replace('\\', os.sep) diff --git a/etiquette/objects.py b/etiquette/objects.py index 72f89ee..fe45817 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -779,7 +779,6 @@ class Photo(ObjectBase): db_row = normalize_db_row(db_row, self.table) self.real_path = db_row['filepath'] - self.real_path = helpers.remove_path_badchars(self.real_path, allowed=':\\/') self.real_path = pathclass.Path(self.real_path) self.id = db_row['id']