bucketPolicy: Trim incoming paths properly for policy verification.

This commit is contained in:
Harshavardhana 2016-09-11 10:33:49 -07:00
parent 07aa02f196
commit 85e2d886bc

View File

@ -42,7 +42,7 @@ func enforceBucketPolicy(bucket string, action string, reqURL *url.URL) (s3Error
} }
// Construct resource in 'arn:aws:s3:::examplebucket/object' format. // Construct resource in 'arn:aws:s3:::examplebucket/object' format.
resource := AWSResourcePrefix + strings.TrimPrefix(reqURL.Path, "/") resource := AWSResourcePrefix + strings.TrimSuffix(strings.TrimPrefix(reqURL.Path, "/"), "/")
// Get conditions for policy verification. // Get conditions for policy verification.
conditionKeyMap := make(map[string]set.StringSet) conditionKeyMap := make(map[string]set.StringSet)