@valentinkolb/filegate 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/package.json +1 -1
- package/src/handlers/upload.ts +7 -0
package/LICENSE
CHANGED
package/package.json
CHANGED
package/src/handlers/upload.ts
CHANGED
|
@@ -83,6 +83,13 @@ const assembleFile = async (meta: UploadMeta): Promise<string | null> => {
|
|
|
83
83
|
const chunks = await getUploadedChunks(meta.uploadId);
|
|
84
84
|
if (chunks.length !== meta.totalChunks) return "missing chunks";
|
|
85
85
|
|
|
86
|
+
// Verify all expected chunk indices are present (0 to totalChunks-1)
|
|
87
|
+
const expectedChunks = Array.from({ length: meta.totalChunks }, (_, i) => i);
|
|
88
|
+
const missingChunks = expectedChunks.filter((i) => !chunks.includes(i));
|
|
89
|
+
if (missingChunks.length > 0) {
|
|
90
|
+
return `missing chunk indices: ${missingChunks.join(", ")}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
86
93
|
const fullPath = join(meta.path, meta.filename);
|
|
87
94
|
const pathResult = await validatePath(fullPath);
|
|
88
95
|
if (!pathResult.ok) return pathResult.error;
|