@yoonion/mimi-seed-mcp 0.13.18 → 0.13.19
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.
|
@@ -85,7 +85,14 @@ async function uploadChunks(absPath, ops) {
|
|
|
85
85
|
for (const op of ops) {
|
|
86
86
|
// 파일 전체를 메모리에 올리지 않는다 — 동영상은 수백 MB 가 될 수 있다.
|
|
87
87
|
const chunk = Buffer.alloc(op.length);
|
|
88
|
-
fs.readSync(fd, chunk, 0, op.length, op.offset);
|
|
88
|
+
const bytesRead = fs.readSync(fd, chunk, 0, op.length, op.offset);
|
|
89
|
+
// Buffer.alloc 은 0 으로 채운다 — 짧게 읽힌 걸 모르고 보내면 **0 패딩이 영상 데이터로**
|
|
90
|
+
// 올라가고, PUT 은 성공한 뒤 체크섬 불일치가 한참 뒤 인코딩 실패로 나타난다.
|
|
91
|
+
// 여기서 즉시 멈추는 게 그 추적 불가능한 실패보다 낫다.
|
|
92
|
+
if (bytesRead !== op.length) {
|
|
93
|
+
throw new Error(`파일을 읽는 중 크기가 어긋났다 (offset ${op.offset}: ${op.length} 바이트 요청, ${bytesRead} 읽음). ` +
|
|
94
|
+
'업로드 도중 파일이 바뀌었을 수 있다 — 파일을 확인하고 다시 시도할 것.');
|
|
95
|
+
}
|
|
89
96
|
const headers = {};
|
|
90
97
|
for (const h of op.requestHeaders ?? [])
|
|
91
98
|
headers[h.name] = h.value;
|
package/package.json
CHANGED