Fix mistaken backreference in some titles

This should resolve #267
This commit is contained in:
Serene-Arc 2021-04-13 16:40:22 +10:00 committed by Ali Parlakci
parent 59ab5d8777
commit 48dca9e5ee
2 changed files with 3 additions and 1 deletions

View File

@ -45,7 +45,8 @@ class FileNameFormatter:
if re.search(fr'(?i).*{{{key}}}.*', result):
key_value = str(attributes.get(key, 'unknown'))
key_value = FileNameFormatter._convert_unicode_escapes(key_value)
result = re.sub(fr'(?i){{{key}}}', key_value, result,)
key_value = key_value.replace('\\', '\\\\')
result = re.sub(fr'(?i){{{key}}}', key_value, result)
result = result.replace('/', '')

View File

@ -303,6 +303,7 @@ def test_multilevel_folder_scheme(
('test😍', 'test😍'),
('test😍 ', 'test😍 '),
('test😍 \\u2019', 'test😍 '),
('Using that real good [1\\4]', 'Using that real good [1\\4]'),
))
def test_preserve_emojis(test_name_string: str, expected: str, submission: MagicMock):
submission.title = test_name_string