From c1d522f08fb9974def9878be49e065d451e2d30a Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Fri, 11 Aug 2023 22:46:19 -0500 Subject: [PATCH] Use relative routing --- public/index/constants.js | 4 ++-- test/index/routeFile.test.ts | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/public/index/constants.js b/public/index/constants.js index b53b92a..8a8d8ea 100644 --- a/public/index/constants.js +++ b/public/index/constants.js @@ -21,7 +21,7 @@ export const SUPPORTED_FILE_TYPES = [ name: "GIF", extensions: [".gif", "image/gif"], mimeType: "image/gif", - route: "/gif", + route: "gif", mimeSniffPatterns: [ { bytes: [0x47, 0x49, 0x46, 0x38, 0x37, 0x61], @@ -37,7 +37,7 @@ export const SUPPORTED_FILE_TYPES = [ name: "PNG", extensions: [".png", ".apng"], mimeType: "image/png", - route: "/png", + route: "png", mimeSniffPatterns: [{ bytes: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A], mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], diff --git a/test/index/routeFile.test.ts b/test/index/routeFile.test.ts index b49a47a..7d1622c 100644 --- a/test/index/routeFile.test.ts +++ b/test/index/routeFile.test.ts @@ -21,16 +21,16 @@ Deno.test("routes files correctly", async () => { [new File([], "foo.txt"), null], [new File([], "foo.txt", { type: "text/plain" }), null], // GIF - [new File([], "foo", { type: "image/gif" }), "/gif"], - [new File([], "foo.gif"), "/gif"], - [new File([], "foo.gif", { type: "text/plain" }), "/gif"], - [new File([GIF87_SIGNATURE], "foo"), "/gif"], - [new File([GIF89_SIGNATURE], "foo"), "/gif"], + [new File([], "foo", { type: "image/gif" }), "gif"], + [new File([], "foo.gif"), "gif"], + [new File([], "foo.gif", { type: "text/plain" }), "gif"], + [new File([GIF87_SIGNATURE], "foo"), "gif"], + [new File([GIF89_SIGNATURE], "foo"), "gif"], // PNG - [new File([], "foo", { type: "image/png" }), "/png"], - [new File([], "foo.png"), "/png"], - [new File([], "foo.png", { type: "text/plain" }), "/png"], - [new File([PNG_SIGNATURE], "foo"), "/png"], + [new File([], "foo", { type: "image/png" }), "png"], + [new File([], "foo.png"), "png"], + [new File([], "foo.png", { type: "text/plain" }), "png"], + [new File([PNG_SIGNATURE], "foo"), "png"], ]); for (const [file, expected] of testCases) {