From 59f06638987b0e97d5d212963fabb3b27ab04e6d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 19 Jan 2020 23:09:37 +0000 Subject: [PATCH] Accept varying avatar filenames --- daemon.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/daemon.py b/daemon.py index 6b933f30..817aa955 100644 --- a/daemon.py +++ b/daemon.py @@ -1353,6 +1353,13 @@ class PubServer(BaseHTTPRequestHandler): if '/' in avatarStr and '.temp.' not in self.path: avatarNickname=avatarStr.split('/')[0] avatarFile=avatarStr.split('/')[1] + # remove any numbers, eg. avatar123.png becomes avatar.png + if avatarFile.startswith('avatar'): + if avatarFile.endswith('.png') or \ + avatarFile.endswith('.jpg') or \ + avatarFile.endswith('.gif') or \ + avatarFile.endswith('.webp'): + avatarFile='avatar.'+avatarFile.split('.')[1] avatarFilename= \ self.server.baseDir+'/accounts/'+ \ avatarNickname+'@'+ \