silverstripe-asset-admin icon indicating copy to clipboard operation
silverstripe-asset-admin copied to clipboard

Upload errors because file exists on disk

Open NightJar opened this issue 6 years ago • 2 comments

Story time

I am a user I have created a file by uploading test.jpg I don't want that file any more I delete that file via asset admin 🤔 whoops maybe I did want that file 😅 I try to upload it again (to the same folder) invisible error the upload just appears to be fine I reload the page File is gone

I am a web developer I open the network tab in my browser's development tools I upload the file again (to the same folder) I see a 500 error from my server. The UI is fine about this, it shows me a successful upload. The 500 error (because I'm in dev mode) tells me the file already exists on disk.

Analysis time

Files are versioned by default The file does exist, because maybe I want to restore the old file (object) I deleted after I first uploaded.

Solutions?

Surely it would be best to silently swallow this error and simply re-associate the file on disk to the new file object I'm creating? Or maybe even restore the existing archived file object record with a new version? (probably a less good idea).

😕 Could there at least be an error message?

NightJar avatar Apr 10 '19 00:04 NightJar

feels like we may need a .archive protected folder where we could move the deleted files and then restore them if necessary

dnsl48 avatar Jun 07 '19 01:06 dnsl48

I upload the file again (to the same folder) I see a 500 error from my server.

I was expecting it to work in the same way as we handle pages with matching urls - just add a suffix to the file name or something like that...

dnsl48 avatar Jun 07 '19 01:06 dnsl48