diff --git a/internal/photoprism/index_mediafile.go b/internal/photoprism/index_mediafile.go index 39e54e45d..c62cee7ec 100644 --- a/internal/photoprism/index_mediafile.go +++ b/internal/photoprism/index_mediafile.go @@ -178,7 +178,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) ( if photoQuery = entity.UnscopedDb().First(&photo, "photo_path = ? AND photo_name = ?", filePath, fullBase); photoQuery.Error == nil || fileBase == fullBase || o.Single { // Skip next query. - } else if photoQuery = entity.UnscopedDb().First(&photo, "photo_path = ? AND photo_name = ?", filePath, fileBase); photoQuery.Error == nil { + } else if photoQuery = entity.UnscopedDb().First(&photo, "photo_path = ? AND photo_name = ? AND photo_single = 0", filePath, fileBase); photoQuery.Error == nil { fileStacked = true }