Skip to content

Commit 26c7055

Browse files
committed
fix: restore upload coverage gates
1 parent b665545 commit 26c7055

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/upload/large.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export async function uploadLargeFile(
276276
await partSha1.update(data)
277277
const sha1Hex = await partSha1.digest()
278278

279-
// Best-effort resume dedup gate: metadata and lengths are not enough.
279+
// Best-effort resume deduplication gate: metadata and lengths are not enough.
280280
// A SHA-1 match is not a cryptographic guarantee against malicious
281281
// bucket co-writers, so auto-resume is documented for mutually trusted
282282
// writers only.

src/upload/upload-coverage.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,26 @@ describe('uploadLargeFile resume=true with no candidate', () => {
12251225
expect(result.fileInfo).toEqual(fileInfo)
12261226
})
12271227

1228+
it('uses empty fileInfo with custom resume discovery limits', async () => {
1229+
const partSize = 100_000
1230+
const data = deterministicBytes(partSize * 2)
1231+
1232+
const result = await uploadLargeFile(client.raw, client.accountInfo, {
1233+
bucketId: bucketId as never,
1234+
fileName: 'resume-empty-fileinfo.bin',
1235+
source: new BufferSource(data),
1236+
partSize,
1237+
concurrency: 1,
1238+
resume: true,
1239+
resumeMaxListPages: 3,
1240+
resumeMaxPartCandidates: 4,
1241+
resumeMaxPartPages: 5,
1242+
onResumeCandidateRejected: () => {},
1243+
})
1244+
1245+
expect(result.fileInfo).toEqual({})
1246+
})
1247+
12281248
it('skips a same-name unfinished upload with conflicting resume identity', async () => {
12291249
const partSize = 100_000
12301250
const data = deterministicBytes(partSize * 2 + 7)

0 commit comments

Comments
 (0)