fix(routes): correct handling of embed files

Enhanced logic for handling file embeds to ensure proper processing of
both downloadable and embedded files. Fixed issues related to condition
checks and image embedding. This improves reliability and correctness
when rendering different types of content attachments.

Fixes issue with inconsistent file embed handling.
This commit is contained in:
Kumi 2024-07-29 17:06:24 +02:00
parent 20c03bb4e0
commit e845caff0e
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -158,10 +158,14 @@ def init_main_routes(app):
for file in step["files"]: for file in step["files"]:
if file["image"] and "embedType" not in "file": if file["image"] and "embedType" not in "file":
step_imgs.append( step_imgs.append(
{"src": proxy(file["downloadUrl"], file["name"]), "alt": file["name"]} {
"src": proxy(file["downloadUrl"], file["name"]),
"alt": file["name"],
}
) )
elif not file["image"]: elif not file["image"]:
if "downloadUrl" in file.keys():
step_downloads.append( step_downloads.append(
{ {
"src": proxy(file["downloadUrl"], file["name"]), "src": proxy(file["downloadUrl"], file["name"]),
@ -187,7 +191,8 @@ def init_main_routes(app):
"https://www.youtube.com" "https://www.youtube.com"
): ):
src = src.replace( src = src.replace(
"https://www.youtube.com", app.config["INVIDIOUS"] "https://www.youtube.com",
app.config["INVIDIOUS"],
) )
elif not app.config["UNSAFE"]: elif not app.config["UNSAFE"]: