JPEG: Try to fix all files with "invalid JPEG format" error #1673 #2463

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-02-21 17:45:35 +01:00
parent 7ed5e0d122
commit 4bd632881b

View file

@ -3,6 +3,7 @@ package photoprism
import (
"fmt"
"image"
"strings"
"time"
"github.com/disintegration/imaging"
@ -98,9 +99,9 @@ func (m *MediaFile) CreateThumbnails(thumbPath string, force bool) (err error) {
if original == nil {
img, err := thumb.Open(m.FileName(), m.Orientation())
// Handle error and try to fix broken JPEGs if possible.
// Try to fix broken JPEGs if possible, fail otherwise.
if err != nil {
if err.Error() != "invalid JPEG format: bad RST marker while decoding" {
if !strings.HasPrefix(err.Error(), "invalid JPEG format") {
log.Debugf("media: %s in %s", err.Error(), clean.Log(m.RootRelName()))
return err
}