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

Revise prefix requirement in list request #3022

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alyssaxu333
Copy link
Contributor

Summary

Changed the list request check and processing from NamedBlobPath to S3GetHandler.

Testing Done

Local test and unit test.

@alyssaxu333 alyssaxu333 marked this pull request as ready for review March 3, 2025 20:45
@@ -537,6 +537,7 @@ public static final class InternalKeys {
* Rest method for the rest request
*/
public static final String REST_METHOD = KEY_PREFIX + "rest-method";
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this REST_METHOD right? Can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I'll remove it.

RequestPath requestPath = (RequestPath) restRequest.getArgs().get(REQUEST_PATH);
return restRequest.getRestMethod() == RestMethod.GET && restRequest.getArgs().containsKey(S3_REQUEST)
&& NamedBlobPath.parse(requestPath, restRequest.getArgs()).getBlobName() == null;
&& splitPath(requestPath.getOperationOrBlobId(true)).length == LIST_REQUEST_SEGMENTS;
Copy link
Contributor

Choose a reason for hiding this comment

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

QQ. Why changing this?

@@ -97,7 +99,7 @@ public static NamedBlobPath parseS3(String path, Map<String, Object> args) throw
boolean isGetObjectLockRequest = args.containsKey(OBJECT_LOCK_PARAM);
// For s3 request, if splitPath.length = 3 && Method = GET, the expected segments = 3
// All other requests require segments = 4
boolean isListObjectRequest = RestUtils.isListObjectRequest(path, args);
boolean isListObjectRequest = args.containsKey(LIST_REQUEST);
int expectedSegments = (isListObjectRequest || isGetObjectLockRequest) ? 3 : 4;
if (splitPath.length != expectedSegments || !Operations.NAMED_BLOB.equalsIgnoreCase(splitPath[0])) {
throw new RestServiceException(String.format(
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm.. isListObjectRequest is true if number of segments is 3. And then, if isListObjectRequest is true, expected segments = 3. Wondering if this is equivalent to checking if splitPath.length == 3 or splitPath.length == 4.

It means GET /s3/account-name/container-name is treated as LIST request? + @justinlin-linkedin also.

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.

4 participants