Compare commits

...

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
aae830c7bf Complete HEIC and JXL orientation fix - all checks passed
Co-authored-by: tankerkiller125 <3457368+tankerkiller125@users.noreply.github.com>
2025-10-18 03:22:37 +00:00
copilot-swe-agent[bot]
0516669b06 Fix HEIC and JXL image rotation by properly reading orientation metadata
Co-authored-by: tankerkiller125 <3457368+tankerkiller125@users.noreply.github.com>
2025-10-18 03:19:41 +00:00
copilot-swe-agent[bot]
2184d08de9 Initial plan 2025-10-18 03:04:48 +00:00
2 changed files with 27 additions and 5 deletions

14
.scaffold/go.sum Normal file
View File

@@ -0,0 +1,14 @@
entgo.io/ent v0.14.5 h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=
entgo.io/ent v0.14.5/go.mod h1:zTzLmWtPvGpmSwtkaayM2cm5m819NdM7z7tYPq3vN0U=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/sysadminsmedia/homebox/backend v0.0.0-20251011125515-397a1c6f3e28 h1:/+aasMDlraSwlQBe/wb+P0Ir0cfwsOkSMqAWEprFAug=
github.com/sysadminsmedia/homebox/backend v0.0.0-20251011125515-397a1c6f3e28/go.mod h1:eO7Zyond1Dw9roeYTVd3W88xYeWSOiYqpF6r2qOKVlA=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -629,7 +629,7 @@ func (r *AttachmentRepo) CreateThumbnail(ctx context.Context, groupId, attachmen
log.Debug().Msg("creating thumbnail for heic file")
img, err := heic.Decode(bytes.NewReader(contentBytes))
if err != nil {
log.Err(err).Msg("failed to decode avif image")
log.Err(err).Msg("failed to decode heic image")
err := tx.Rollback()
if err != nil {
return err
@@ -637,9 +637,9 @@ func (r *AttachmentRepo) CreateThumbnail(ctx context.Context, groupId, attachmen
return err
}
log.Debug().Msg("reading original file orientation")
imageMeta, err := imagemeta.Decode(bytes.NewReader(contentBytes))
imageMeta, err := imagemeta.DecodeHeif(bytes.NewReader(contentBytes))
if err != nil {
log.Err(err).Msg("failed to decode original file content")
log.Err(err).Msg("failed to decode heic file metadata")
err := tx.Rollback()
if err != nil {
return err
@@ -660,14 +660,22 @@ func (r *AttachmentRepo) CreateThumbnail(ctx context.Context, groupId, attachmen
log.Debug().Msg("creating thumbnail for jpegxl file")
img, err := jpegxl.Decode(bytes.NewReader(contentBytes))
if err != nil {
log.Err(err).Msg("failed to decode avif image")
log.Err(err).Msg("failed to decode jpegxl image")
err := tx.Rollback()
if err != nil {
return err
}
return err
}
thumbnailPath, err := r.processThumbnailFromImage(ctx, groupId, img, title, uint16(1))
log.Debug().Msg("reading original file orientation")
orientation := uint16(1) // Default orientation
imageMeta, err := imagemeta.Decode(bytes.NewReader(contentBytes))
if err != nil {
log.Debug().Msg("unable to decode jxl metadata, using default orientation")
} else {
orientation = uint16(imageMeta.Orientation)
}
thumbnailPath, err := r.processThumbnailFromImage(ctx, groupId, img, title, orientation)
if err != nil {
err := tx.Rollback()
if err != nil {