Index: Ignore primary files with errors

This commit is contained in:
Michael Mayer 2021-10-05 20:29:48 +02:00
parent 4556250b49
commit 481f409601

View file

@ -229,7 +229,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
// Flag first JPEG as primary file for this photo.
if !file.FilePrimary {
if photoExists {
if q := entity.UnscopedDb().Where("file_type = 'jpg' AND file_primary = 1 AND photo_id = ?", photo.ID).First(&primaryFile); q.Error != nil {
if res := entity.UnscopedDb().Where("photo_id = ? AND file_primary = 1 AND file_type = 'jpg' AND file_error = ''", photo.ID).First(&primaryFile); res.Error != nil {
file.FilePrimary = m.IsJpeg()
}
} else {