Mark files are missing, when they are not found

This commit is contained in:
Michael Mayer 2018-09-27 12:10:19 +02:00
parent e845046a99
commit 7640cae26b
3 changed files with 6 additions and 1 deletions

View file

@ -54,6 +54,10 @@ func GetThumbnail(router *gin.RouterGroup, conf *photoprism.Config) {
} else {
log.Printf("could not find image for thumbnail: %s", err.Error())
c.Data(404, "image/svg+xml", photoIconSvg)
// Set missing flag so that the file doesn't show up in search results anymore
file.FileMissing = true
conf.GetDb().Update(file)
}
})
}

View file

@ -188,6 +188,7 @@ func (i *Indexer) IndexMediaFile(mediaFile *MediaFile) string {
file.PhotoID = photo.ID
file.FilePrimary = isPrimary
file.FileMissing = false
file.FileName = relativeFileName
file.FileHash = fileHash
file.FileType = mediaFile.GetType()

View file

@ -107,7 +107,7 @@ func (s *Search) Photos(form PhotoSearchForm) ([]PhotoSearchResult, error) {
Joins("LEFT JOIN locations ON locations.id = photos.location_id").
Joins("LEFT JOIN photo_tags ON photo_tags.photo_id = photos.id").
Joins("LEFT JOIN tags ON photo_tags.tag_id = tags.id").
Where("photos.deleted_at IS NULL AND photos.file_missing = 0").
Where("photos.deleted_at IS NULL AND files.file_missing = 0").
Group("photos.id, files.id")
if form.Query != "" {