Skip to content

Commit f4a79e8

Browse files
committed
add encoded filename as part of upload url
1 parent 7c7fc8a commit f4a79e8

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/ListObjects.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,11 @@ const ListObjects = () => {
547547
}
548548

549549
if (encodedPath !== "") {
550-
uploadUrl = `${uploadUrl}?prefix=${encodedPath}&fileName=${encodeURLString(
550+
uploadUrl = `${uploadUrl}?prefix=${encodedPath}${encodeURLString(
551551
fileName,
552552
)}`;
553553
} else {
554-
// if passed as prefix it would be treated as folder in backend
555-
uploadUrl = `${uploadUrl}?fileName=${encodeURLString(fileName)}`;
554+
uploadUrl = `${uploadUrl}?prefix=${encodeURLString(fileName)}`;
556555
}
557556

558557
const identity = encodeURLString(

restapi/user_objects.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"io"
2525
"net/http"
2626
"net/url"
27-
"path"
2827
"path/filepath"
2928
"regexp"
3029
"strconv"
@@ -1030,8 +1029,8 @@ func uploadFiles(ctx context.Context, client MinioClient, params objectApi.PostB
10301029
if contentType == "" {
10311030
contentType = mimedb.TypeByExtension(filepath.Ext(p.FileName()))
10321031
}
1033-
1034-
_, err = client.putObject(ctx, params.BucketName, path.Join(prefix, path.Clean(p.FileName())), p, size, minio.PutObjectOptions{
1032+
objectName := prefix // prefix will have complete object path e.g: /test-prefix/test-object.txt
1033+
_, err = client.putObject(ctx, params.BucketName, objectName, p, size, minio.PutObjectOptions{
10351034
ContentType: contentType,
10361035
DisableMultipart: true, // Do not upload as multipart stream for console uploader.
10371036
})

0 commit comments

Comments
 (0)