-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Now that #50 is fixed so that duplicate uploads return a link, we could really do with a way of preventing Nextshot from overwriting existing files.
Nextcloud automatically overwrites, so we would need to ping the webdav API prior to sending the upload request. If a file exists with the same name, the user should be able to decide how to proceed.
Rename/overwrite/abort prompt is taken care of with #83, leaving only config/runtime args:
Config Option
There should be an option in nextshot.conf to define the default behaviour.
Something like overwrite=<action> could work, with possible values of:
overwrite=always- overwrite automatically without asking (previous behaviour)overwrite=append- automatically append iterator/timestamp to the filenameoverwrite=rename- never overwrite, ask for a new filename each timeoverwrite=prompt- ask whether to overwrite or rename at runtime (current behaviour)overwrite=cancel- always abort the upload(?)
The best option to set by default if the config isn't set would probably be prompt. The idea of Nextshot is to minimise interaction though, so perhaps always would be the better default here.
Runtime Args
While a config option should cover most cases, there should also be ways of overriding it on a case-by-case basis.
--no-overwritewould be useful if config is set toalways--overwritecould likewise be handy for bypassing prompts occasionally
How useful these would be though is questionable. Maybe skip them unless someone really wants it - the config option is still better than always overwriting without any choice in the matter.
Caveats
- Appending to the filename automatically is good in theory, but in practice it's not so easy to implement. Extra care would need to be taken to avoid
somefile-1-1-1-1-1.pngor bumping tosomefile-2.pngonly to find that also exists. Possibly leave this option for a later release. - Aborting upload really isn't the most useful option, so that can probably be ignored.