mirror of
https://github.com/minio/minio.git
synced 2024-12-23 21:55:53 -05:00
fix: avoid URL unsafe chars in multipart upload ID (#16034)
This commit is contained in:
parent
40a2c6b882
commit
5f1999cc71
@ -43,7 +43,7 @@ import (
|
||||
|
||||
func (er erasureObjects) getUploadIDDir(bucket, object, uploadID string) string {
|
||||
uploadUUID := uploadID
|
||||
uploadBytes, err := base64.StdEncoding.DecodeString(uploadID)
|
||||
uploadBytes, err := base64.RawURLEncoding.DecodeString(uploadID)
|
||||
if err == nil {
|
||||
slc := strings.SplitN(string(uploadBytes), ".", 2)
|
||||
if len(slc) == 2 {
|
||||
@ -432,7 +432,7 @@ func (er erasureObjects) newMultipartUpload(ctx context.Context, bucket string,
|
||||
partsMetadata[index].Metadata = userDefined
|
||||
}
|
||||
uploadUUID := mustGetUUID()
|
||||
uploadID := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s.%s", globalDeploymentID, uploadUUID)))
|
||||
uploadID := base64.RawURLEncoding.EncodeToString([]byte(fmt.Sprintf("%s.%s", globalDeploymentID, uploadUUID)))
|
||||
uploadIDPath := er.getUploadIDDir(bucket, object, uploadUUID)
|
||||
|
||||
// Write updated `xl.meta` to all disks.
|
||||
|
@ -109,7 +109,7 @@ func checkListMultipartArgs(ctx context.Context, bucket, prefix, keyMarker, uplo
|
||||
KeyMarker: keyMarker,
|
||||
}
|
||||
}
|
||||
_, err := base64.StdEncoding.DecodeString(uploadIDMarker)
|
||||
_, err := base64.RawURLEncoding.DecodeString(uploadIDMarker)
|
||||
if err != nil {
|
||||
logger.LogIf(ctx, err)
|
||||
return MalformedUploadID{
|
||||
|
@ -1051,9 +1051,10 @@ func testListMultipartUploads(obj ObjectLayer, instanceType string, t TestErrHan
|
||||
fmt.Errorf("Invalid combination of uploadID marker '%s' and marker '%s'", "abc", "asia/europe/"), false,
|
||||
},
|
||||
{
|
||||
bucketNames[0], "asia", "asia/europe", "abc", "", 0,
|
||||
// Contains a base64 padding character
|
||||
bucketNames[0], "asia", "asia/europe", "abc=", "", 0,
|
||||
ListMultipartsInfo{},
|
||||
fmt.Errorf("Malformed upload id %s", "abc"), false,
|
||||
fmt.Errorf("Malformed upload id %s", "abc="), false,
|
||||
},
|
||||
|
||||
// Setting up valid case of ListMultiPartUploads.
|
||||
|
Loading…
Reference in New Issue
Block a user