File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
src/routes/data/[...item]/[filename] Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff 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
5557function mimeTypeMatches ( contentType : string , matchers : ( string | RegExp ) [ ] ) : boolean {
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments