From cd7c37b136c7e4956ebc4e50a38338f1e02f0e26 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 17 Oct 2022 20:21:09 +0200 Subject: [PATCH] Fixed regression where OPTIONS resulted in 500 instead of 404 --- plugs/core/template.ts | 3 +-- server/http_server.ts | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugs/core/template.ts b/plugs/core/template.ts index 7f3f601..e0ef65a 100644 --- a/plugs/core/template.ts +++ b/plugs/core/template.ts @@ -130,8 +130,7 @@ export async function dailyNoteCommand() { }); let dailyNoteTemplateText = ""; try { - const text = await space.readPage(dailyNoteTemplate); - dailyNoteTemplateText = text; + dailyNoteTemplateText = await space.readPage(dailyNoteTemplate); } catch { console.warn(`No daily note template found at ${dailyNoteTemplate}`); } diff --git a/server/http_server.ts b/server/http_server.ts index 5b9ca65..43f0b2e 100644 --- a/server/http_server.ts +++ b/server/http_server.ts @@ -439,10 +439,10 @@ function buildFsRouter(spacePrimitives: SpacePrimitives): Router { response.headers.set("X-Last-Modified", "" + meta.lastModified); response.headers.set("X-Content-Length", "" + meta.size); response.headers.set("X-Permission", meta.perm); - } catch (err) { - response.status = 500; - response.body = "Options failed"; - console.error("Options failed", err); + } catch { + response.status = 404; + response.body = "File not found"; + // console.error("Options failed", err); } }) .delete("\/(.+)", async ({ response, params }) => {