From 63c1f15cee5829d239fb687b9f7775d5918f52d8 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sat, 3 Oct 2026 11:12:18 +0200 Subject: [PATCH] fix(search): take the photo iso from exif:IsoSpeedRatings Base ISO is a Canon maker note tag holding Canon's raw encoded value, not the iso of the shot: other cameras got no iso, Canon photos a wrong one (256 for an ISO 800 shot). exif:IsoSpeedRatings is there on tika 3 and tika 4. --- services/search/pkg/content/tika_photo.go | 2 +- services/search/pkg/content/tika_photo_test.go | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/services/search/pkg/content/tika_photo.go b/services/search/pkg/content/tika_photo.go index 20798cc5fa..f2cecf90c1 100644 --- a/services/search/pkg/content/tika_photo.go +++ b/services/search/pkg/content/tika_photo.go @@ -40,7 +40,7 @@ func (t Tika) getPhoto(meta map[string][]string) *libregraph.Photo { } } - if v, err := getFirstValue(meta, "Base ISO"); err == nil { + if v, err := getFirstValue(meta, "exif:IsoSpeedRatings"); err == nil { if i, err := strconv.ParseInt(v, 0, 32); err == nil { initPhoto() photo.SetIso(int32(i)) diff --git a/services/search/pkg/content/tika_photo_test.go b/services/search/pkg/content/tika_photo_test.go index 9995d59587..c2357b6995 100644 --- a/services/search/pkg/content/tika_photo_test.go +++ b/services/search/pkg/content/tika_photo_test.go @@ -16,7 +16,7 @@ var _ = Describe("getPhoto", func() { "exif:ExposureTime": {"0.001"}, "exif:FNumber": {"1.8"}, "exif:FocalLength": {"50"}, - "Base ISO": {"100"}, + "exif:IsoSpeedRatings": {"100"}, "tiff:Orientation": {"1"}, "exif:DateTimeOriginal": {"2018-01-01T12:34:56"}, }) @@ -32,6 +32,16 @@ var _ = Describe("getPhoto", func() { Expect(photo.TakenDateTime).To(Equal(libregraph.PtrTime(time.Date(2018, 1, 1, 12, 34, 56, 0, time.UTC)))) }) + It("takes the iso of the shot, not the canon maker note base iso", func() { + photo := Tika{}.getPhoto(map[string][]string{ + "exif:IsoSpeedRatings": {"800"}, + "Base ISO": {"256"}, + "img:Base ISO": {"256"}, + }) + Expect(photo).ToNot(BeNil()) + Expect(photo.Iso).To(Equal(libregraph.PtrInt32(800))) + }) + It("returns nil when no photo metadata is present", func() { Expect(Tika{}.getPhoto(map[string][]string{})).To(BeNil()) })