fix: crash on zip download if zip is larger than 4GB (#709)
This commit is contained in:
committed by
GitHub
parent
856c54d5d6
commit
bfd4049c15
@@ -54,13 +54,14 @@ export class FileController {
|
|||||||
@Res({ passthrough: true }) res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Param("shareId") shareId: string,
|
@Param("shareId") shareId: string,
|
||||||
) {
|
) {
|
||||||
const zip = await this.fileService.getZip(shareId);
|
const zipStream = this.fileService.getZip(shareId);
|
||||||
|
|
||||||
res.set({
|
res.set({
|
||||||
"Content-Type": "application/zip",
|
"Content-Type": "application/zip",
|
||||||
"Content-Disposition": contentDisposition(`${shareId}.zip`),
|
"Content-Disposition": contentDisposition(`${shareId}.zip`),
|
||||||
});
|
});
|
||||||
|
|
||||||
return new StreamableFile(zip);
|
return new StreamableFile(zipStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(":fileId")
|
@Get(":fileId")
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export class FileService {
|
|||||||
|
|
||||||
getZip(shareId: string) {
|
getZip(shareId: string) {
|
||||||
const storageService = this.getStorageService();
|
const storageService = this.getStorageService();
|
||||||
return this.streamToUint8Array(storageService.getZip(shareId) as Readable);
|
return storageService.getZip(shareId) as Readable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async streamToUint8Array(stream: Readable): Promise<Uint8Array> {
|
private async streamToUint8Array(stream: Readable): Promise<Uint8Array> {
|
||||||
|
|||||||
Reference in New Issue
Block a user