Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[S3] Validate parts in multi-part upload #2981

Merged
merged 5 commits into from
Jan 15, 2025
Merged

Conversation

alyssaxu333
Copy link
Contributor

Currently there's no check for the invalid part number and duplicate etags. Add checks for part number that is negative, decimal or larger than 10000, throw Bad Request Error. Add checks for duplicate eTags in the request to avoid time out.


Set<Integer> partNumbers = new HashSet<>();
Set<String> etags = new HashSet<>();

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove Whitespace

for (Part part : parts) {
int partNumber = part.getPartNumber();
String etag = part.geteTag();

Copy link
Contributor

Choose a reason for hiding this comment

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

Rm white space

"Invalid part number: " + part.getPartNumber() + ". Part number must be an integer between {} and {}.",
MIN_PART_NUM, MAX_PART_NUM);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Rm white space

if (!partNumbers.add(partNumber)) {
return "Duplicate part number found: " + partNumber;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Rm white space

@snalli
Copy link
Contributor

snalli commented Jan 14, 2025

Nit : change title to
[s3] Validate parts in multi-part upload

Make sure this is the title when merging else github will use the original title

@alyssaxu333 alyssaxu333 changed the title Add part number and etags check for complete multipart request [S3] Validate parts in multi-part upload Jan 14, 2025
@alyssaxu333 alyssaxu333 force-pushed the addPartCheckForCompleteRequest branch from d16b951 to 7c1ebb6 Compare January 14, 2025 21:38
@alyssaxu333 alyssaxu333 force-pushed the addPartCheckForCompleteRequest branch from 85c1b2a to 3b9c81e Compare January 15, 2025 05:36
@snalli snalli merged commit 3e96437 into master Jan 15, 2025
3 of 4 checks passed
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.

None yet

3 participants