You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't find an issue specifically about this so I thought it would be useful to make one as it's mentioned in #295 and #231
As a user who has found that their attempt to add a bench failed somehow, I want to be able to try adding that bench again without that being prevented by a message about how one of the photos "exists in the database".
The error message shown to people says "in database" but the check is whether the photo exists on disk.
I am assuming that a reason for preventing people adding benches using photos that are already on disk is to protect against people forgetting they added a bench and then adding it again. (I haven't been able to think of any other reasons but would be happy to hear about them. 😄 )
Does it matter if the photo is on disk already, so long as it is not associated with any bench? If not, perhaps a better check to do would be, does the photo exist on disk and if so does it's hash appear in the media table along with a benchID and if so does that benchID appear in the benches table. If all those three things are true, then reject the upload with a message about how the photo is already associated with a bench (maybe even say which bench). But if the only one of those checks which is true is the photo exists on disk, then don't fail. (Silently overwrite or discard the photo and use what's already on disk? Shouldn't matter in theory as the result of either should be the same. 🤷)
I am assuming that no one could be bothered to go to the effort of expending the resources to create a SHA-1 collision with an existing OpenBenches photo. 😄
The text was updated successfully, but these errors were encountered:
I can't find an issue specifically about this so I thought it would be useful to make one as it's mentioned in #295 and #231
As a user who has found that their attempt to add a bench failed somehow, I want to be able to try adding that bench again without that being prevented by a message about how one of the photos "exists in the database".
The error message shown to people says "in database" but the check is whether the photo exists on disk.
openbenches.org/www/functions.php
Line 677 in 3e4cf64
openbenches.org/www/upload.php
Line 37 in 3e4cf64
I am assuming that a reason for preventing people adding benches using photos that are already on disk is to protect against people forgetting they added a bench and then adding it again. (I haven't been able to think of any other reasons but would be happy to hear about them. 😄 )
Does it matter if the photo is on disk already, so long as it is not associated with any bench? If not, perhaps a better check to do would be, does the photo exist on disk and if so does it's hash appear in the
media
table along with abenchID
and if so does thatbenchID
appear in thebenches
table. If all those three things are true, then reject the upload with a message about how the photo is already associated with a bench (maybe even say which bench). But if the only one of those checks which is true is the photo exists on disk, then don't fail. (Silently overwrite or discard the photo and use what's already on disk? Shouldn't matter in theory as the result of either should be the same. 🤷)I am assuming that no one could be bothered to go to the effort of expending the resources to create a SHA-1 collision with an existing OpenBenches photo. 😄
The text was updated successfully, but these errors were encountered: