Purge: Prevent SQL error when the photo ID of a file is missing #2540

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2022-07-22 19:47:16 +02:00
parent 397159d4e0
commit d81579071b
2 changed files with 27 additions and 17 deletions

View File

@@ -13,6 +13,16 @@ import (
"github.com/photoprism/photoprism/pkg/projection"
)
func TestFile_RegenerateIndex(t *testing.T) {
t.Run("FirstFileByHash", func(t *testing.T) {
f, err := FirstFileByHash("2cad9168fa6acc5c5c2965ddf6ec465ca42fd818")
if err != nil {
t.Fatal(err)
}
f.RegenerateIndex()
})
}
func TestFirstFileByHash(t *testing.T) {
t.Run("not existing file", func(t *testing.T) {
f, err := FirstFileByHash("xxx")