Replies: 1 comment 8 replies
-
Hey, thanks for looking into this. It is indeed a case that we haven't considered before. I think the most straightforward solution would be:
It is just a |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
One can upload multiple files with the same name, e.g.:
or soon also with
This case was never taken into consideration. I thought about it, but there's no easy solution:
First I thought about checking for a file with the same name and removing it first. Bad idea, because one can thus replace/delete a file, even without a delete token.
Throw an error message when a file with the same name already exists on the server.
Adding more metadata to the filename on the server. e.g. append the
token
. Only a request with the same token may replace a file as described in 1. What to do, when auth tokens are not set? Should everyone be allowed to replace a file? Or just throw a message as in 2. Also, this is a rather big code change.Use a database instead of messing with the filenames on the server. This would be the most clean, but IMO out of the scope of rustypaste. This would already develop towards role based access control and the rewrite would be extensive.
The only viable solution I could come up with was to add another config option, e.g.
reject_same_filename
. If set totrue
, an error message is returned, when a file with the same name exists on the server already. If not set, or set tofalse
, the current behavior is observed.Beta Was this translation helpful? Give feedback.
All reactions