Rename "fileRouter.js" to "routeFile.js"
This change should have no user impact.
This commit is contained in:
parent
e9dd9aec85
commit
c0ed212937
|
@ -3,7 +3,7 @@
|
||||||
import { SUPPORTED_FILE_TYPES } from "./constants.js";
|
import { SUPPORTED_FILE_TYPES } from "./constants.js";
|
||||||
import crel from "../common/crel.js";
|
import crel from "../common/crel.js";
|
||||||
import * as base64url from "../common/base64url.js";
|
import * as base64url from "../common/base64url.js";
|
||||||
import { routeFile } from "./fileRouter.js";
|
import routeFile from "./routeFile.js";
|
||||||
|
|
||||||
const accept = SUPPORTED_FILE_TYPES
|
const accept = SUPPORTED_FILE_TYPES
|
||||||
.flatMap((t) => [t.mimeType, ...t.extensions])
|
.flatMap((t) => [t.mimeType, ...t.extensions])
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { SUPPORTED_FILE_TYPES } from "./constants.js";
|
||||||
* @param {File} file
|
* @param {File} file
|
||||||
* @returns {Promise<null | string>} The route for the file, or null if the file is not supported.
|
* @returns {Promise<null | string>} 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) ??
|
const fileType = findFileTypeUsingMimeType(file.type) ??
|
||||||
fineFileTypeUsingFileName(file.name) ??
|
fineFileTypeUsingFileName(file.name) ??
|
||||||
(await findFileTypeWithMimeSniffing(file));
|
(await findFileTypeWithMimeSniffing(file));
|
|
@ -1,5 +1,5 @@
|
||||||
import { assertEquals } from "assert";
|
import { assertEquals } from "assert";
|
||||||
import { routeFile } from "../../public/index/fileRouter.js";
|
import routeFile from "../../public/index/routeFile.js";
|
||||||
|
|
||||||
Deno.test("routes files correctly", async () => {
|
Deno.test("routes files correctly", async () => {
|
||||||
const PNG_SIGNATURE = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
|
const PNG_SIGNATURE = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
|
Loading…
Reference in New Issue