1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-10 17:30:11 +01:00

Merge branch 'fix_missing_icon' into 'master'

Use default icon for index if the file does not exist

See merge request fdroid/fdroidserver!1374
This commit is contained in:
Jochen Sprickerhof 2024-06-07 11:02:33 +00:00
commit 390aaa0214

View File

@ -647,11 +647,16 @@ def load_localized_config(name, repodir):
ret[afname][key] = dict()
if key == "icon":
icons_dir = os.path.join(repodir, 'icons')
# make sure the icon filename contains only a file name
# to restrict files to the config directory.
icon = os.path.basename(value)
if not os.path.exists(icons_dir):
os.makedirs(icons_dir, exist_ok=True)
shutil.copy(os.path.join("config", value), icons_dir)
if not os.path.exists(os.path.join("config", icon)):
ret[afname][key][locale] = ret[afname][key][DEFAULT_LOCALE]
shutil.copy(os.path.join("config", icon), icons_dir)
ret[afname][key][locale] = file_entry(
os.path.join(icons_dir, value)
os.path.join(icons_dir, icon)
)
else:
ret[afname][key][locale] = value