Use relative routing

This commit is contained in:
Evan Hahn 2023-08-11 22:46:19 -05:00
parent b8d76ac793
commit c1d522f08f
2 changed files with 11 additions and 11 deletions

View File

@ -21,7 +21,7 @@ export const SUPPORTED_FILE_TYPES = [
name: "GIF", name: "GIF",
extensions: [".gif", "image/gif"], extensions: [".gif", "image/gif"],
mimeType: "image/gif", mimeType: "image/gif",
route: "/gif", route: "gif",
mimeSniffPatterns: [ mimeSniffPatterns: [
{ {
bytes: [0x47, 0x49, 0x46, 0x38, 0x37, 0x61], bytes: [0x47, 0x49, 0x46, 0x38, 0x37, 0x61],
@ -37,7 +37,7 @@ export const SUPPORTED_FILE_TYPES = [
name: "PNG", name: "PNG",
extensions: [".png", ".apng"], extensions: [".png", ".apng"],
mimeType: "image/png", mimeType: "image/png",
route: "/png", route: "png",
mimeSniffPatterns: [{ mimeSniffPatterns: [{
bytes: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A], bytes: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A],
mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], 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"), null],
[new File([], "foo.txt", { type: "text/plain" }), null], [new File([], "foo.txt", { type: "text/plain" }), null],
// GIF // GIF
[new File([], "foo", { type: "image/gif" }), "/gif"], [new File([], "foo", { type: "image/gif" }), "gif"],
[new File([], "foo.gif"), "/gif"], [new File([], "foo.gif"), "gif"],
[new File([], "foo.gif", { type: "text/plain" }), "/gif"], [new File([], "foo.gif", { type: "text/plain" }), "gif"],
[new File([GIF87_SIGNATURE], "foo"), "/gif"], [new File([GIF87_SIGNATURE], "foo"), "gif"],
[new File([GIF89_SIGNATURE], "foo"), "/gif"], [new File([GIF89_SIGNATURE], "foo"), "gif"],
// PNG // PNG
[new File([], "foo", { type: "image/png" }), "/png"], [new File([], "foo", { type: "image/png" }), "png"],
[new File([], "foo.png"), "/png"], [new File([], "foo.png"), "png"],
[new File([], "foo.png", { type: "text/plain" }), "/png"], [new File([], "foo.png", { type: "text/plain" }), "png"],
[new File([PNG_SIGNATURE], "foo"), "/png"], [new File([PNG_SIGNATURE], "foo"), "png"],
]); ]);
for (const [file, expected] of testCases) { for (const [file, expected] of testCases) {