Skip to content
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

add encoded filename as part of upload url #3140

Merged
merged 6 commits into from
Dec 6, 2023

Conversation

prakashsvmx
Copy link
Member

@prakashsvmx prakashsvmx commented Dec 1, 2023

pass encoded file name also as part of the url.

  • Upload a single/multiole files
  • Upload a folder
  • Drag and drop
  • upload under a prefix

the file name is part of prefix= parameter. parameter added for tooling support.

e.g:

http://localhost:5005/api/v1/buckets/test-bucket/objects/upload?prefix=dGVzdC1wcmVmaXgvMS5kb2M=
http://localhost:5005/api/v1/buckets/test-bucket/objects/upload?prefix=MS5wbmc=

dvaldivia
dvaldivia previously approved these changes Dec 1, 2023
Copy link
Collaborator

@dvaldivia dvaldivia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@cesnietor
Copy link
Collaborator

cesnietor commented Dec 1, 2023

@prakashsvmx can we make it part of the same parameter prefix? all other apis have both, the path and the object in there. Otherwise the tooling app will have to do a corner case for this particular api.

Copy link
Collaborator

@cesnietor cesnietor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see comments

@prakashsvmx
Copy link
Member Author

@cesnietor if prefix is passed, backend makes it as a folder. So I isolated it (and added code comments) to make it non breaking change.

@cesnietor
Copy link
Collaborator

cesnietor commented Dec 1, 2023

@cesnietor if prefix is passed, backend makes it as a folder. So I isolated it (and added code comments) to make it non breaking change.

yes, in this case we would need to change the backend a bit. that's fine.
Instead of using prefix + file name it would have to be whole prefix.

_, 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.
		})

to :

_, err = client.putObject(ctx, params.BucketName, prefix,...

if it's not that simple, let me know, thanks @prakashsvmx

@prakashsvmx
Copy link
Member Author

Thank you @cesnietor . I will check and update.

@prakashsvmx prakashsvmx force-pushed the upload-fname-url branch 5 times, most recently from 132d382 to 3080971 Compare December 4, 2023 10:39
cesnietor
cesnietor previously approved these changes Dec 4, 2023
Copy link
Collaborator

@cesnietor cesnietor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested LGTM, thanks @prakashsvmx !

@cesnietor
Copy link
Collaborator

cesnietor commented Dec 4, 2023

I tried uploading a Folder with the following objects inside and some uploads failed
Screenshot 2023-12-04 at 11 07 41 AM
Screenshot 2023-12-04 at 11 07 18 AM
Screenshot 2023-12-04 at 11 08 34 AM

Requests failing:
http://localhost:5005/api/v1/buckets/bucket1/objects/upload?prefix=L2ZvbGRlcjEvZm9sZGVyMy8=cGRmd2l0aEFsZXJ0LnBkZg==
and
http://localhost:5005/api/v1/buckets/bucket1/objects/upload?prefix=L2ZvbGRlcjEvMi8=cGRmd2l0aEFsZXJ0LnBkZg==

@cesnietor cesnietor self-requested a review December 4, 2023 19:09
@allanrogerr allanrogerr self-requested a review December 4, 2023 19:56
@prakashsvmx
Copy link
Member Author

@cesnietor , Thank you, i have now updated , and also the tests related to back end changes.

@allanrogerr
Copy link
Contributor

@prakashsvmx Please check Vulnerability #1: GO-2023-2382

Copy link
Contributor

@allanrogerr allanrogerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested

@cesnietor
Copy link
Collaborator

tested LGTM

@cesnietor cesnietor merged commit 607d94f into minio:master Dec 6, 2023
28 of 30 checks passed
cesnietor pushed a commit to cesnietor/console that referenced this pull request Jan 12, 2024
cesnietor pushed a commit to cesnietor/console that referenced this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants