From 56263a6920c26897948d2af476173f81aa7887d5 Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Fri, 10 Nov 2023 12:06:05 -0600 Subject: [PATCH] Fix bad routes --- 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 8a8d8ea..4725a0e 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 7d1622c..0d71771 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) {