silverstripe-asset-admin
silverstripe-asset-admin copied to clipboard
Upload errors because file exists on disk
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?
feels like we may need a .archive protected folder where we could move the deleted files and then restore them if necessary
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...