From 922499cb64552b627916b245957702ac465e2536 Mon Sep 17 00:00:00 2001 From: Eva Date: Thu, 21 Mar 2024 02:23:42 +0100 Subject: [PATCH] server/embed: return 404 on post not found --- server/szurubooru/api/embed_api.py | 2 +- server/szurubooru/rest/app.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/szurubooru/api/embed_api.py b/server/szurubooru/api/embed_api.py index dbead402..c83a8a50 100644 --- a/server/szurubooru/api/embed_api.py +++ b/server/szurubooru/api/embed_api.py @@ -81,7 +81,7 @@ def post_index(ctx: rest.Context, params: Dict[str, str]) -> rest.Response: try: oembed = get_post(ctx, {}, path) except posts.PostNotFoundError: - return {"return_type": "custom", "content": index_html} + return {"return_type": "custom", "status_code": "404", "content": index_html} url = config.config["site_url"] + path new_html = index_html.replace("", f''' diff --git a/server/szurubooru/rest/app.py b/server/szurubooru/rest/app.py index d95bb145..8aa188b5 100644 --- a/server/szurubooru/rest/app.py +++ b/server/szurubooru/rest/app.py @@ -113,7 +113,7 @@ def application( db.session.remove() if type(response) == dict and response.get("return_type") == "custom": - start_response("200", [("content-type", "text/html")]) + start_response(response.get("status_code", "200"), [("content-type", "text/html")]) return (response.get("content", "").encode("utf-8"),) start_response("200", [("content-type", "application/json")])