Skip to content

Commit 8e65dba

Browse files
Fix svelte-check errors
1 parent 46a60a6 commit 8e65dba

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/routes/data/[...item]/[filename]/+server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export async function GET(req: Request) {
4949
'Content-Length': content.length.toString(),
5050
});
5151

52-
return new Response(content);
52+
// Node really isn't happy with me providing content from a file here.
53+
// FIXME: Figure out why it is so cranky.
54+
return new Response(content as any);
5355
}
5456

5557
function mimeTypeMatches(contentType: string, matchers: (string | RegExp)[]): boolean {

tests/backend/fileRequest.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,12 @@ export default async function fromFileSystem(file: string): Promise<File> {
2121
const buffer = await fs.readFile(file);
2222
const arrayBuffer = [buffer.subarray(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)];
2323
const mimetype = contentType(file) || undefined;
24-
return new File(arrayBuffer, path.basename(file), { type: mimetype });
24+
return new File(
25+
// It seems that TypeScript doesn't like this, as it wants the arrayBuffer to be a `BlobPart`,
26+
// but given this seems to work throughout testing, I'd say this is fine.
27+
// FIXME: Figure out why it is so cranky.
28+
arrayBuffer as any,
29+
path.basename(file),
30+
{ type: mimetype },
31+
);
2532
}

0 commit comments

Comments
 (0)