Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence of an image "in database" due to failed atmempt at adding a bench hinders/prevents it actually getting added. #301

Closed
arizonagroovejet opened this issue Mar 20, 2023 · 1 comment

Comments

@arizonagroovejet
Copy link
Contributor

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.

function duplicate_file($filename) {

if (duplicate_file($filename))

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. 😄

@edent
Copy link
Collaborator

edent commented Apr 9, 2023

Working on this now.

It will look like this:
Screenshot showing an error message with a link to a duplicate bench.

@edent edent closed this as completed in 768203d Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants