ChainSafe / ui-monorepo

ChainSafe Files & Storage UI Monorepo
GNU General Public License v3.0
50 stars 16 forks source link

Handle duplicate file uploads elegantly #2127

Open FSM1 opened 2 years ago

FSM1 commented 2 years ago

Is your feature request related to a problem? Please describe. Currently duplicate file uploads are not handled very well. The API will respond with a 409 error, and a notification will be displayed, but no further action will be presented to the user.

Describe the solution you'd like If a file with the same name already exists, a pop-up should be displayed to the user to allow them to either

image

FSM1 commented 2 years ago

Discuss the API changes with the team and continue scoping this out.

Preliminary idea is to make a request to the API with a full list of files to be uploaded, and the API to respond with any possible conflicting file names, as well as valid name that the file can be renamed to (if user wants to keep both files).

FSM1 commented 2 years ago

@dhyaniarun1993 API now returns a 409 in the event of a duplicate file upload anywhere in the request. Any files that are valid will be stored correctly in the filesystem. The API will respond with the file name that is a duplicate, as well as a suggestion of the name that the file can be renamed to -

i.e. if a path contains:

and the user attempts to upload a file called a.txt the API would respond with a valid name of a (2).txt