Skip to content

Commit

Permalink
JPEG: Try to fix all files with "invalid JPEG format" error photopris…
Browse files Browse the repository at this point in the history
…m#1673 photoprism#2463

Signed-off-by: Michael Mayer <michael@photoprism.app>
  • Loading branch information
lastzero authored and seeschloss committed Apr 10, 2023
1 parent b33586d commit ebfbe23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/photoprism/mediafile_thumbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package photoprism
import (
"fmt"
"image"
"strings"
"time"

"github.com/disintegration/imaging"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit ebfbe23

Please sign in to comment.