Skip to content

Commit 6edcced

Browse files
committed
imgae: reject files that are larger than 128GiB
1 parent ddf3d15 commit 6edcced

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/lib/nodes/image/upload.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ const upload = new Command("upload")
9494
const fileInfo = await Deno.stat(filePath);
9595
const fileSize = fileInfo.size;
9696

97+
// Check file size limit (128 GiB)
98+
const maxFileSize = 128 * 1024 * 1024 * 1024; // 128 GiB in bytes
99+
if (fileSize > maxFileSize) {
100+
throw new Error(
101+
`File size exceeds maximum allowed size of 128 GiB. File size: ${(fileSize / (1024 * 1024 * 1024)).toFixed(2)} GiB`,
102+
);
103+
}
104+
97105
// Calculate parts for progress tracking
98106
const minChunk = 5 * 1024 * 1024; // 5 MiB (minimum)
99107
const defaultChunk = 64 * 1024 * 1024; // 64 MiB

0 commit comments

Comments
 (0)