do not add preceding '/' for putRequests (#2306)
This commit is contained in:
@@ -37,7 +37,7 @@ const globalAppName = "MinIO Console"
|
||||
|
||||
// NewAdminClientWithInsecure gives a new madmin client interface either secure or insecure based on parameter
|
||||
func NewAdminClientWithInsecure(url, accessKey, secretKey, sessionToken string, insecure bool) (*madmin.AdminClient, *probe.Error) {
|
||||
s3Client, err := s3AdminNew(&mcCmd.Config{
|
||||
admClient, err := s3AdminNew(&mcCmd.Config{
|
||||
HostURL: url,
|
||||
AccessKey: accessKey,
|
||||
SecretKey: secretKey,
|
||||
@@ -50,8 +50,10 @@ func NewAdminClientWithInsecure(url, accessKey, secretKey, sessionToken string,
|
||||
return nil, err.Trace(url)
|
||||
}
|
||||
stsClient := PrepareConsoleHTTPClient(insecure)
|
||||
s3Client.SetCustomTransport(stsClient.Transport)
|
||||
return s3Client, nil
|
||||
admClient.SetCustomTransport(stsClient.Transport)
|
||||
// set user-agent to differentiate Console UI requests for auditing.
|
||||
admClient.SetAppInfo("MinIO Console", pkg.Version)
|
||||
return admClient, nil
|
||||
}
|
||||
|
||||
// s3AdminNew returns an initialized minioAdmin structure. If debug is enabled,
|
||||
|
||||
@@ -382,6 +382,8 @@ func newMinioClient(claims *models.Principal) (*minio.Client, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// set user-agent to differentiate Console UI requests for auditing.
|
||||
minioClient.SetAppInfo("MinIO Console", pkg.Version)
|
||||
return minioClient, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -800,6 +800,9 @@ func uploadFiles(ctx context.Context, client MinioClient, params objectApi.PostB
|
||||
return err
|
||||
}
|
||||
prefix = string(decodedPrefix)
|
||||
// trim any leading '/', since that is not expected
|
||||
// for any object.
|
||||
prefix = strings.TrimPrefix(prefix, "/")
|
||||
}
|
||||
|
||||
// parse a request body as multipart/form-data.
|
||||
@@ -825,7 +828,7 @@ func uploadFiles(ctx context.Context, client MinioClient, params objectApi.PostB
|
||||
contentType = mimedb.TypeByExtension(filepath.Ext(p.FileName()))
|
||||
}
|
||||
|
||||
_, err = client.putObject(ctx, params.BucketName, path.Join(prefix, p.FileName()), p, size, minio.PutObjectOptions{
|
||||
_, err = client.putObject(ctx, params.BucketName, path.Join(prefix, path.Clean(p.FileName())), p, size, minio.PutObjectOptions{
|
||||
ContentType: contentType,
|
||||
DisableMultipart: true, // Do not upload as multipart stream for console uploader.
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user