Root cause:prisma.photo.create() failed with invalid byte sequence for encoding "UTF8": 0x00 (Postgres 22021). EXIF/IPTC readers only trim a trailing NUL pad (exif.tsstr()) or none at all (embedded.tstext()), so a camera string with an embedded 0x00 byte reached the insert.
Fix:apps/api/src/lib/sanitize.ts adds stripNulBytes, a small recursive sanitizer (strings/arrays/plain objects; leaves Date and other instances untouched) applied to the photo.create() data in apps/api/src/ingest/service.ts, covering the flat camera fields and the nested exif/embeddedIptc JSON blobs in one pass.
Tests:apps/api/src/lib/sanitize.test.ts (unit, 3 cases: mid-string NUL removal, nested object/array recursion matching the real data shape, Date passthrough). Full src/lib + src/ingest suite green locally against photoreport_test.
Single occurrence (2026-10-15), no duplicates since.
Fixes BIT-31182.
**Root cause:** `prisma.photo.create()` failed with `invalid byte sequence for encoding "UTF8": 0x00` (Postgres 22021). EXIF/IPTC readers only trim a trailing NUL pad (`exif.ts` `str()`) or none at all (`embedded.ts` `text()`), so a camera string with an embedded 0x00 byte reached the insert.
**Fix:** `apps/api/src/lib/sanitize.ts` adds `stripNulBytes`, a small recursive sanitizer (strings/arrays/plain objects; leaves `Date` and other instances untouched) applied to the `photo.create()` data in `apps/api/src/ingest/service.ts`, covering the flat camera fields and the nested `exif`/`embeddedIptc` JSON blobs in one pass.
**Tests:** `apps/api/src/lib/sanitize.test.ts` (unit, 3 cases: mid-string NUL removal, nested object/array recursion matching the real data shape, Date passthrough). Full `src/lib` + `src/ingest` suite green locally against `photoreport_test`.
Single occurrence (2026-10-15), no duplicates since.
EXIF/IPTC readers only trimmed a trailing NUL pad (exif.ts str()) or none at
all (embedded.ts text()), so a camera string with an embedded 0x00 byte
reached prisma.photo.create() and Postgres rejected the whole insert with
"invalid byte sequence for encoding \"UTF8\": 0x00" (22021), failing the photo
permanently. Run the create payload through a small recursive sanitizer
that strips NUL bytes from every string, nested object and array (so
exif/embeddedIptc JSON blobs are covered too) while leaving Date and other
non-plain values untouched.
BIT-31182
Paperclip-Agent: Miguel Teixeira (urlKey miguel-teixeira; id 0f722e1a-bc3e-4381-8d98-76fa3c7aea10)
Paperclip-Issue: BIT-31182
Paperclip-Run: 052a774e-42b2-4c28-8734-ac4cc5714c47
Detail: failed contexts: ci / typescript (pull_request)
The bot did not approve or schedule a merge for this head.
Fix the branch, approve as CTO, or close the PR. The bot re-checks on the next run.
@cto — Gitea autopilot needs a CTO decision on BitReport.pt/photoreport#91: CI is red on the PR head.
- Head: `16e3dd2c536f`
- Detail: failed contexts: ci / typescript (pull_request)
- The bot did **not** approve or schedule a merge for this head.
- Fix the branch, approve as CTO, or close the PR. The bot re-checks on the next run.
<!-- gitea-autopilot-escalation kind=ci_failure sha=16e3dd2c536f -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes BIT-31182.
Root cause:
prisma.photo.create()failed withinvalid byte sequence for encoding "UTF8": 0x00(Postgres 22021). EXIF/IPTC readers only trim a trailing NUL pad (exif.tsstr()) or none at all (embedded.tstext()), so a camera string with an embedded 0x00 byte reached the insert.Fix:
apps/api/src/lib/sanitize.tsaddsstripNulBytes, a small recursive sanitizer (strings/arrays/plain objects; leavesDateand other instances untouched) applied to thephoto.create()data inapps/api/src/ingest/service.ts, covering the flat camera fields and the nestedexif/embeddedIptcJSON blobs in one pass.Tests:
apps/api/src/lib/sanitize.test.ts(unit, 3 cases: mid-string NUL removal, nested object/array recursion matching the real data shape, Date passthrough). Fullsrc/lib+src/ingestsuite green locally againstphotoreport_test.Single occurrence (2026-10-15), no duplicates since.
@cto — Gitea autopilot needs a CTO decision on BitReport.pt/photoreport#91: CI is red on the PR head.
16e3dd2c536f