Repository navigation
Description
Summary
ListParts is not routed. GET /<bucket>/<key>?uploadId=ID falls through to the
GetObject arm of parseS3Operation, so it looks for an object at the upload's key
and answers 404 NoSuchKey — even for an upload with parts successfully stored.
There is no listParts handler in the plugin at all (grep -rn 'listParts' emulator/
→ 0 hits), so this is a missing operation rather than a broken one.
Found while reproducing #532: ListParts is the natural way a caller diagnoses an
InvalidPart failure from CompleteMultipartUpload, and it is unavailable exactly
when it is most needed.
Reproducer
$ aws s3api create-multipart-upload --bucket lp-probe --key k
{"Bucket": "lp-probe", "Key": "k", "UploadId": "mpu-1785797912176650000"}
$ aws s3api upload-part --bucket lp-probe --key k --part-number 1 \
--upload-id mpu-... --body /tmp/5mb # succeeds
$ aws s3api list-parts --bucket lp-probe --key k --upload-id mpu-...
An error occurred (NoSuchKey) when calling the ListParts operation:
The specified key does not exist.
Raw wire confirms the misroute rather than an empty result:
$ curl -s -o - -w 'http=%{http_code}\n' \
"http://localhost:4601/lp-probe/k2?uploadId=mpu-..."
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message>
<RequestId>SUBSTRATE</RequestId></Error>
http=404
Cause
parseS3Operation (emulator/s3_plugin.go:341-348) — the object-level GET arm
checks acl and tagging and then returns GetObject. It never checks uploadId.
Note the asymmetry with the sibling arms, which makes the omission clear: PUT
checks partNumber+uploadId → UploadPart (:337), DELETE checks uploadId
→ AbortMultipartUpload (:352), and POST checks uploadId →
CompleteMultipartUpload (:363). GET is the only multipart verb whose
uploadId check is missing.
The state to answer from already exists — uploadPart persists each part, and
completeMultipartUpload reads them back to assemble the object.
Acceptance criteria
-
GET /<bucket>/<key>?uploadId=IDroutes to a newListPartshandler, ahead
of theGetObjectfallback. - Response shape verified against the
ListParts reference:
ListPartsResultwithBucket,Key,UploadId,PartNumberMarker,
NextPartNumberMarker,MaxParts,IsTruncated,StorageClass,Initiator,
Owner, and aPartelement per part carryingPartNumber,ETag,Size,
LastModified. - An upload with zero parts returns
200with an empty part list, not a 404. -
NoSuchUploadfor an unknownuploadId— the correct error, distinct from
today'sNoSuchKey. -
max-parts/part-number-markerpagination honoured. - Test asserts on raw XML bytes, since a Go round-trip cannot see a wire
naming or routing error (the lesson from Logs: DescribeLogGroups/DescribeLogStreams/GetLogEvents return PascalCase members, so an SDK parses every field to null #528/API Gateway: state structs are marshalled straight to the wire, so responses are PascalCase and carry substrate's internal AccountID/Region #529).
Related
- S3: UploadPartCopy is routed to CopyObject, so multipart server-side copy silently produces a whole-object copy #532 —
UploadPartCopymisrouted in the same function, in thePUTarm. Same
root cause (a multipart check missing or ordered behind a more general one) and
worth fixing together.
Activity
feat(s3): route UploadPartCopy and ListParts (#532, #551) (#552)