From c0ed2129376e60d063345f1c99c32bf5bf411eca Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Fri, 11 Aug 2023 14:42:32 -0500 Subject: [PATCH] Rename "fileRouter.js" to "routeFile.js" This change should have no user impact. --- public/index/index.js | 2 +- public/index/{fileRouter.js => routeFile.js} | 2 +- test/index/{fileRouter.test.ts => routeFile.test.ts} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename public/index/{fileRouter.js => routeFile.js} (97%) rename test/index/{fileRouter.test.ts => routeFile.test.ts} (93%) diff --git a/public/index/index.js b/public/index/index.js index 09b0841..0c24bc2 100644 --- a/public/index/index.js +++ b/public/index/index.js @@ -3,7 +3,7 @@ import { SUPPORTED_FILE_TYPES } from "./constants.js"; import crel from "../common/crel.js"; import * as base64url from "../common/base64url.js"; -import { routeFile } from "./fileRouter.js"; +import routeFile from "./routeFile.js"; const accept = SUPPORTED_FILE_TYPES .flatMap((t) => [t.mimeType, ...t.extensions]) diff --git a/public/index/fileRouter.js b/public/index/routeFile.js similarity index 97% rename from public/index/fileRouter.js rename to public/index/routeFile.js index 4d175f1..9cd6e98 100644 --- a/public/index/fileRouter.js +++ b/public/index/routeFile.js @@ -10,7 +10,7 @@ import { SUPPORTED_FILE_TYPES } from "./constants.js"; * @param {File} file * @returns {Promise} The route for the file, or null if the file is not supported. */ -export const routeFile = async (file) => { +export default async (file) => { const fileType = findFileTypeUsingMimeType(file.type) ?? fineFileTypeUsingFileName(file.name) ?? (await findFileTypeWithMimeSniffing(file)); diff --git a/test/index/fileRouter.test.ts b/test/index/routeFile.test.ts similarity index 93% rename from test/index/fileRouter.test.ts rename to test/index/routeFile.test.ts index eb9c919..de1612f 100644 --- a/test/index/fileRouter.test.ts +++ b/test/index/routeFile.test.ts @@ -1,5 +1,5 @@ import { assertEquals } from "assert"; -import { routeFile } from "../../public/index/fileRouter.js"; +import routeFile from "../../public/index/routeFile.js"; Deno.test("routes files correctly", async () => { const PNG_SIGNATURE = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);