Fix bad routes

This commit is contained in:
Evan Hahn 2023-11-10 12:06:05 -06:00
parent 71df4dd767
commit 56263a6920
2 changed files with 11 additions and 11 deletions

View File

@ -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],

View File

@ -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) {