@valentinkolb/filegate 2.3.3 → 2.3.4
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/package.json +1 -1
- package/src/handlers/upload.ts +7 -7
package/package.json
CHANGED
package/src/handlers/upload.ts
CHANGED
|
@@ -113,20 +113,20 @@ const assembleFile = async (meta: UploadMeta): Promise<string | null> => {
|
|
|
113
113
|
|
|
114
114
|
try {
|
|
115
115
|
for (let i = 0; i < meta.totalChunks; i++) {
|
|
116
|
-
|
|
117
|
-
const chunkFile = Bun.file(
|
|
116
|
+
const chunkFilePath = chunkPath(meta.uploadId, i);
|
|
117
|
+
const chunkFile = Bun.file(chunkFilePath);
|
|
118
118
|
|
|
119
|
-
// Verify chunk exists before
|
|
119
|
+
// Verify chunk exists before reading
|
|
120
120
|
if (!(await chunkFile.exists())) {
|
|
121
121
|
writer.end();
|
|
122
122
|
await rm(pathResult.realPath).catch(() => {});
|
|
123
123
|
return `chunk ${i} not found during assembly`;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
// Read chunk as buffer (more reliable than streaming)
|
|
127
|
+
const data = new Uint8Array(await chunkFile.arrayBuffer());
|
|
128
|
+
hasher.update(data);
|
|
129
|
+
writer.write(data);
|
|
130
130
|
}
|
|
131
131
|
await writer.end();
|
|
132
132
|
} catch (e) {
|