Skip to content

Prevent duplicate uploads by enforcing unique image hash #28

@Alxandr

Description

@Alxandr

Enforce hash-level deduplication so the same binary image cannot be uploaded multiple times.

Scope

  • Add a database-level unique constraint on image hash (sha256).
  • Update upload write path to handle uniqueness violations gracefully.
  • Return a user-facing duplicate error that explains the image already exists.
  • Keep existing successful upload flow unchanged for new images.

Acceptance Criteria

  • Attempting to upload the same image bytes twice does not create a second image row.
  • Duplicate uploads return a deterministic, user-friendly error response.
  • New unique images continue uploading successfully.
  • Automated tests cover both first-upload success and duplicate-upload rejection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions