Media: Add test for creating thumbs from broken JPEG #2721
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
19b4490232
commit
3b7b551cca
3 changed files with 24 additions and 1 deletions
|
@ -106,7 +106,7 @@ func (m *MediaFile) MetaData() (result meta.Data) {
|
|||
|
||||
if err != nil {
|
||||
m.metaData.Error = err
|
||||
log.Debugf("metadata: %s in %s", err, clean.Log(m.BaseName()))
|
||||
log.Debugf("%s in %s", err, clean.Log(m.BaseName()))
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -200,6 +200,29 @@ func TestMediaFile_CreateThumbnails(t *testing.T) {
|
|||
assert.FileExists(t, thumbFilename)
|
||||
assert.NoError(t, m.CreateThumbnails(thumbsPath, false))
|
||||
})
|
||||
|
||||
t.Run("broken/animated-earth.jpg", func(t *testing.T) {
|
||||
m, err := NewMediaFile("testdata/broken/animated-earth.jpg")
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = m.CreateThumbnails(thumbsPath, true)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
thumbFilename, err := thumb.FileName(m.Hash(), thumbsPath, thumb.Sizes[thumb.Tile50].Width, thumb.Sizes[thumb.Tile50].Height, thumb.Sizes[thumb.Tile50].Options...)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.FileExists(t, thumbFilename)
|
||||
assert.NoError(t, m.CreateThumbnails(thumbsPath, false))
|
||||
})
|
||||
}
|
||||
|
||||
func TestMediaFile_ChangeOrientation(t *testing.T) {
|
||||
|
|
BIN
internal/photoprism/testdata/broken/animated-earth.jpg
vendored
Normal file
BIN
internal/photoprism/testdata/broken/animated-earth.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in a new issue