Mark files are missing, when they are not found
This commit is contained in:
parent
e845046a99
commit
7640cae26b
3 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 != "" {
|
||||
|
|
Loading…
Reference in a new issue