From 970c7d1ddfc47c1a8c82ccd6237ac50e08773e69 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 7 Feb 2019 13:36:18 -0800 Subject: [PATCH] notifications: Fix hash-named duplicate sound files in options. Our hash-naming of production assets interacted badly with the "look at files in a directory" algorithm used to determine what sound options exist for the "notification sound" feature. For lack of a better solution, we fix this by excluding files with an extra `.` in their name. --- zerver/lib/actions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 387e17e4ad..7a30fe3a15 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -2853,6 +2853,10 @@ def get_available_notification_sounds() -> List[str]: for file_name in os.listdir(notification_sounds_path): root, ext = os.path.splitext(file_name) + if '.' in root: # nocoverage + # Exclude e.g. zulip.abcd1234.ogg (generated by production hash-naming) + # to avoid spurious duplicates. + continue if ext == '.ogg': available_notification_sounds.append(root)