server/embed: return 404 on post not found
This commit is contained in:
parent
a88e73804c
commit
922499cb64
2 changed files with 2 additions and 2 deletions
|
@ -81,7 +81,7 @@ def post_index(ctx: rest.Context, params: Dict[str, str]) -> rest.Response:
|
||||||
try:
|
try:
|
||||||
oembed = get_post(ctx, {}, path)
|
oembed = get_post(ctx, {}, path)
|
||||||
except posts.PostNotFoundError:
|
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
|
url = config.config["site_url"] + path
|
||||||
new_html = index_html.replace("</head>", f'''
|
new_html = index_html.replace("</head>", f'''
|
||||||
|
|
|
@ -113,7 +113,7 @@ def application(
|
||||||
db.session.remove()
|
db.session.remove()
|
||||||
|
|
||||||
if type(response) == dict and response.get("return_type") == "custom":
|
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"),)
|
return (response.get("content", "").encode("utf-8"),)
|
||||||
|
|
||||||
start_response("200", [("content-type", "application/json")])
|
start_response("200", [("content-type", "application/json")])
|
||||||
|
|
Loading…
Reference in a new issue