From b889c8dfdd689d64778cb1c33746aa8385a5c74a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 20 Nov 2020 09:34:31 +0000 Subject: [PATCH] Check that directory exists --- theme.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/theme.py b/theme.py index 20e3b1ef9..b8dc37e8a 100644 --- a/theme.py +++ b/theme.py @@ -615,10 +615,11 @@ def setTheme(baseDir: str, name: str, domain: str) -> bool: # set the news avatar newsAvatarThemeFilename = \ baseDir + '/theme/' + name + '/icons/avatar_news.png' - if os.path.isfile(newsAvatarThemeFilename): - newsAvatarFilename = \ - baseDir + '/accounts/news@' + domain + '/avatar.png' - copyfile(newsAvatarThemeFilename, newsAvatarFilename) + if os.path.isdir(baseDir + '/accounts/news@' + domain): + if os.path.isfile(newsAvatarThemeFilename): + newsAvatarFilename = \ + baseDir + '/accounts/news@' + domain + '/avatar.png' + copyfile(newsAvatarThemeFilename, newsAvatarFilename) grayscaleFilename = baseDir + '/accounts/.grayscale' if os.path.isfile(grayscaleFilename):