-
Notifications
You must be signed in to change notification settings - Fork 275
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
base: master
Are you sure you want to change the base?
Conversation
6c52d7a
to
7db35b5
Compare
@@ -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"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
Summary
Changed the list request check and processing from NamedBlobPath to S3GetHandler.
Testing Done
Local test and unit test.