Skip to content

Conversation

@helloimalastair
Copy link
Contributor

First pass, may need polishing.


KJ_IF_SOME(o, options) {
KJ_IF_SOME(l, o.limit) {
listBuilder.setLimit(l);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ListMultipartUploads should replicate the same validation logic we have for ListObjects I believe to be fully compliant with S3.

JSG_REQUIRE(l >= 1 && l <= 1000, RangeError,....

kj::StringPtr components[1];
auto path = fillR2Path(components, this->bucket->adminBucket);
CompatibilityFlags::Reader flags = {};
auto promise = doR2HTTPGetRequest(kj::mv(client), kj::mv(requestJson), path, kj::none, flags);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something, but wouldn't this fail if you are explicitly passing in kj::none instead of the JWT?

}

struct R2ListMultipartUploadsRequest {
limit @0 :UInt32 = 0xffffffff;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I am just being paranoid, but would a more sensible default here make more sense (i.e AWS S3 defaults for max values?). IIRC 1000

}
KJ_IF_SOME(p, o.partNumberMarker) {
JSG_REQUIRE(
p >= 0, RangeError, "partNumberMarker must be non-negative. Actual value was: ", p);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is subtle and I learned this recently myself, but the part numbers are 1-indexed so this conditional is bugged since it needs to be strictly greater than.

{
partNumber: 1,
etag: 'partEtag1',
size: '100',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we treating size as a string? (Sorry I am no C++/kj expert so maybe it's normal, but it seems a bit odd)

key: string;
uploadId: string;
initiated?: Date;
storageClass?: string;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe strongly type the storage class with a default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants