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.
This commit is contained in:
Tim Abbott 2019-02-07 13:36:18 -08:00
parent 0f3125582b
commit 970c7d1ddf
1 changed files with 4 additions and 0 deletions

View File

@ -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)