diff --git a/server/szurubooru/api/__init__.py b/server/szurubooru/api/__init__.py index f6b8973a..854c50cb 100644 --- a/server/szurubooru/api/__init__.py +++ b/server/szurubooru/api/__init__.py @@ -1,6 +1,6 @@ import szurubooru.api.comment_api +import szurubooru.api.embed_api import szurubooru.api.info_api -import szurubooru.api.oembed_api import szurubooru.api.password_reset_api import szurubooru.api.pool_api import szurubooru.api.pool_category_api diff --git a/server/szurubooru/api/oembed_api.py b/server/szurubooru/api/embed_api.py similarity index 96% rename from server/szurubooru/api/oembed_api.py rename to server/szurubooru/api/embed_api.py index cfc9046c..dbead402 100644 --- a/server/szurubooru/api/oembed_api.py +++ b/server/szurubooru/api/embed_api.py @@ -78,7 +78,11 @@ def get_post( @rest.routes.get("/index(?P/.+)") def post_index(ctx: rest.Context, params: Dict[str, str]) -> rest.Response: path = _index_path(params) - oembed = get_post(ctx, {}, path) + try: + oembed = get_post(ctx, {}, path) + except posts.PostNotFoundError: + return {"return_type": "custom", "content": index_html} + url = config.config["site_url"] + path new_html = index_html.replace("", f'''