SmilyOrg/photofield

panic: Unable to compute cost, unsupported image format *image.Paletted

Tin-Joy59 opened this issue · 2 comments

Describe the bug
Whenever I try to open an auto-generated collection (my Messenger photos and videos), the app crashes.

Screenshots

Attaching the logs from the crash

2022/09/10 17:38:53 load meta 25% completed, 499 loaded, 1444 pending, 4.50 / sec
2022/09/10 17:38:55 load meta 26% completed, 511 loaded, 1432 pending, 5.66 / sec
2022/09/10 17:38:56 load color 4% completed, 159 loaded, 3751 pending, 1.25 / sec
2022/09/10 17:38:57 load meta 27% completed, 527 loaded, 1416 pending, 7.89 / sec
panic: Unable to compute cost, unsupported image format *image.Paletted
goroutine 38 [running]:
photofield/internal/image.newImageCache.func1({0xcaa940, 0xc01209d770})
/home/runner/work/photofield/photofield/internal/image/cache.go:100 +0x285
github.com/dgraph-io/ristretto.(*Cache).processItems(0xc00023ac00)
/home/runner/go/pkg/mod/github.com/dgraph-io/ristretto@v0.0.2/cache.go:303 +0x109
created by github.com/dgraph-io/ristretto.NewCache
/home/runner/go/pkg/mod/github.com/dgraph-io/ristretto@v0.0.2/cache.go:162 +0x347

Additional context

This particular folder contains some corrupted jpeg files and I know for a fact that some apps have trouble crawling them. I believe Photofield can't handle them and crashes.

Also hey, H_Q_ here.

Hi H_Q_!

It looks like the crash is due to an unexpected/unsupported format, not necessarily due to a corrupt file. I'll take a look when I get the chance!

Thanks for reporting!

v0.5.2 published soon should contain a fix for this 👍