stash/pkg/sqlite
notsafeforgit fcc5b51bfd fix(sqlite): fix image duplicate detection by scanning phash as integer
This fixes a bug where identical image duplicates were not being detected.

The implementation was incorrectly scanning the phash BLOB into a string and then attempting to parse it as a hex string. Since phashes are stored as 64-bit integers, they were being converted to decimal strings. For phashes with the MSB set (negative when treated as int64), the resulting decimal string started with a '-', which caused the hex parser to fail and skip the image entirely.

Additionally, even for non-negative phashes, parsing a decimal string as hex yielded incorrect hash values.

Scanning directly into the utils.Phash struct (which uses int64) matches how Scene phashes are handled and ensures the hash values are correct.
2026-03-29 23:47:36 -07:00
..
blob Developer option: extra blob paths (#4566) 2024-02-16 12:39:45 +11:00
migrations Convert career length fields to dates (#6682) 2026-03-17 15:48:30 +11:00
anonymise.go Backend support for Group custom fields (#6596) 2026-02-23 11:53:12 +11:00
anonymise_test.go Add anonymise database task (#3186) 2022-12-23 09:15:27 +11:00
batch.go Add findFiles and findFile graphql queries (#5941) 2025-06-24 13:05:17 +10:00
blob.go Add related object filter criteria to various filter types in graphql schema (#4861) 2024-06-11 11:34:38 +10:00
blob_migrate.go Add filesystem based blob storage (#3187) 2023-03-17 10:52:49 +11:00
blob_test.go Movie group renames (#5039) 2024-07-04 09:10:26 +10:00
common.go File storage rewrite (#2676) 2022-09-06 07:03:42 +00:00
criterion_handlers.go Fix: Custom Field Filtering (#6614) 2026-02-28 11:05:13 +11:00
custom_fields.go Fix 'not equals' custom field to include unset objects (#6742) 2026-03-26 09:01:43 +11:00
custom_fields_test.go Backend support for image custom fields (#6598) 2026-02-24 07:41:40 +11:00
custom_migrations.go File storage rewrite (#2676) 2022-09-06 07:03:42 +00:00
database.go Convert career length fields to dates (#6682) 2026-03-17 15:48:30 +11:00
date.go Date precision (#6359) 2025-12-08 09:11:40 +11:00
doc.go Add package docs and project vision/goals (#5169) 2024-08-28 09:01:39 +10:00
driver.go Sort special characters before numbers (#3829) 2023-06-22 09:51:21 +10:00
file.go Add option to ignore zip contents during clean (#6700) 2026-03-18 15:58:32 +11:00
file_filter.go fix: support string-based fingerprints in hashes filter (#6654) 2026-03-10 15:07:46 +11:00
file_filter_test.go fix: support string-based fingerprints in hashes filter (#6654) 2026-03-10 15:07:46 +11:00
file_test.go fix: support string-based fingerprints in hashes filter (#6654) 2026-03-10 15:07:46 +11:00
filter.go SQL performance improvements (#6378) 2025-12-08 08:08:31 +11:00
filter_hierarchical.go Containing Group/Sub-Group relationships (#5105) 2024-08-30 11:43:44 +10:00
filter_internal_test.go Restructure data layer (#2532) 2022-09-06 07:03:40 +00:00
fingerprint.go Support setting file fingerprints (#4376) 2023-12-22 14:07:10 +11:00
folder.go Expand folder select hierarchy based on initial selected folder (#6738) 2026-03-23 16:15:23 +11:00
folder_filter.go Add basename and parent_folders fields to Folder graphql interface (#6494) 2026-02-27 10:58:11 +11:00
folder_filter_test.go Add basename and parent_folders fields to Folder graphql interface (#6494) 2026-02-27 10:58:11 +11:00
folder_test.go Add basename and parent_folders fields to Folder graphql interface (#6494) 2026-02-27 10:58:11 +11:00
functions.go Correct title ordering for objects without titles (#3244) 2022-12-09 08:29:34 +11:00
gallery.go Make gallery/scene association during scan more consistent (#6705) 2026-03-19 08:54:44 +11:00
gallery_chapter.go Use slices package from the stdlib when possible (#5360) 2024-10-29 11:26:23 +11:00
gallery_chapter_test.go SQLite model refactoring (#3791) 2023-06-15 12:46:09 +10:00
gallery_filter.go Fix incorrect where clause for gallery parent folder filter (#6737) 2026-03-23 13:45:31 +11:00
gallery_test.go Backend support for Group custom fields (#6596) 2026-02-23 11:53:12 +11:00
group.go Backend support for Group custom fields (#6596) 2026-02-23 11:53:12 +11:00
group_filter.go FR: Add Missing is-missing Filter Options Across all Object Types (#6565) 2026-02-26 16:36:54 +11:00
group_relationships.go Containing Group/Sub-Group relationships (#5105) 2024-08-30 11:43:44 +10:00
group_test.go Backend support for Group custom fields (#6596) 2026-02-23 11:53:12 +11:00
history.go Scene play and o-counter history view and editing (#4532) 2024-02-22 11:28:18 +11:00
image.go fix(sqlite): fix image duplicate detection by scanning phash as integer 2026-03-29 23:47:36 -07:00
image_filter.go fix: update image duplicate checker UI and API handling 2026-03-29 23:47:36 -07:00
image_test.go fix: resolve image duplicate finder issues 2026-03-29 23:47:36 -07:00
migrate.go Fix various migration issues (#5723) 2025-03-19 08:04:21 +11:00
performer.go Sort performers and studios by scenes file size (#6642) 2026-03-18 11:51:56 +11:00
performer_filter.go Convert career length fields to dates (#6682) 2026-03-17 15:48:30 +11:00
performer_test.go Convert career length fields to dates (#6682) 2026-03-17 15:48:30 +11:00
phash.go Phash distance filter (#3596) 2023-04-17 15:36:51 +10:00
query.go Fix: Custom Field Filtering (#6614) 2026-02-28 11:05:13 +11:00
record.go Date precision (#6359) 2025-12-08 09:11:40 +11:00
regex.go Update a number of dependencies (incl. CVE fixes) (#4107) 2023-10-26 16:24:32 +11:00
relationships.go Movie/Group tags (#4969) 2024-06-18 11:24:15 +10:00
repository.go SQL performance improvements (#6378) 2025-12-08 08:08:31 +11:00
saved_filter.go Use slices package from the stdlib when possible (#5360) 2024-10-29 11:26:23 +11:00
saved_filter_test.go Default view filters (#4962) 2024-06-18 10:51:52 +10:00
scene.go Fix: Custom Field Filtering (#6614) 2026-02-28 11:05:13 +11:00
scene_filter.go FR: Add Missing is-missing Filter Options Across all Object Types (#6565) 2026-02-26 16:36:54 +11:00
scene_marker.go SQL performance improvements (#6378) 2025-12-08 08:08:31 +11:00
scene_marker_filter.go Scene Marker duration filter and sort (#5472) 2024-11-29 16:28:10 +11:00
scene_marker_test.go Scene Marker duration filter and sort (#5472) 2024-11-29 16:28:10 +11:00
scene_test.go Convert career length fields to dates (#6682) 2026-03-17 15:48:30 +11:00
setup_test.go Convert career length fields to dates (#6682) 2026-03-17 15:48:30 +11:00
sql.go Convert career length fields to dates (#6682) 2026-03-17 15:48:30 +11:00
stash_id_test.go Feature: Tag StashID support (#6255) 2025-11-13 14:24:09 +11:00
studio.go Sort performers and studios by scenes file size (#6642) 2026-03-18 11:51:56 +11:00
studio_filter.go FR: Add Missing is-missing Filter Options Across all Object Types (#6565) 2026-02-26 16:36:54 +11:00
studio_test.go Feature Request: Add organized flag to studios (#6303) 2026-02-19 09:05:17 +11:00
table.go Expand folder select hierarchy based on initial selected folder (#6738) 2026-03-23 16:15:23 +11:00
tables.go Backend support for image custom fields (#6598) 2026-02-24 07:41:40 +11:00
tag.go Sort performers and studios by scenes file size (#6642) 2026-03-18 11:51:56 +11:00
tag_filter.go FR: Add Missing is-missing Filter Options Across all Object Types (#6565) 2026-02-26 16:36:54 +11:00
tag_test.go Fix: Custom Field Filtering (#6614) 2026-02-28 11:05:13 +11:00
timestamp.go Scene play and o-counter history view and editing (#4532) 2024-02-22 11:28:18 +11:00
transaction.go Database connection pool refactor (#5274) 2024-09-20 12:56:26 +10:00
transaction_test.go Upgrade gqlgenc (#5901) 2025-06-03 08:55:51 +10:00
tx.go SQL performance improvements (#6378) 2025-12-08 08:08:31 +11:00
values.go Model refactor (#3915) 2023-09-01 10:39:29 +10:00