From c64f09f28b101df17873ce5665f7382ef1a0f278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20M=C3=B6ller?= Date: Fri, 26 Jun 2026 16:43:55 +0300 Subject: [PATCH] Fix GetRawUnit for v1 MPR files: convert UUID to GUID blob GetRawUnit passed the UUID string directly to SQLite for v1 MPRs, but UnitID is stored as a 16-byte GUID blob. The query never matched, silently returning "no rows" for every unit lookup on v1 projects. Use types.UUIDToBlob() before querying, consistent with getUnitByIDV1() in reader_units.go and GetRawUnitBytes() in writer_security.go which already have the correct implementation. Fixes #705 Co-Authored-By: Claude Opus 4.6 --- sdk/mpr/reader_documents.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/mpr/reader_documents.go b/sdk/mpr/reader_documents.go index a64cc18eb..a8b735bb4 100644 --- a/sdk/mpr/reader_documents.go +++ b/sdk/mpr/reader_documents.go @@ -462,8 +462,9 @@ func (r *Reader) GetRawUnit(id model.ID) (map[string]any, error) { return nil, fmt.Errorf("failed to read unit contents: %w", err) } } else { - // V1: Read from database - row := r.db.QueryRow("SELECT Contents FROM Unit WHERE UnitID = ?", string(id)) + // V1: Read from database — convert UUID to GUID blob for the query + unitIDBlob := types.UUIDToBlob(string(id)) + row := r.db.QueryRow("SELECT Contents FROM Unit WHERE UnitID = ?", unitIDBlob) err = row.Scan(&contents) if err != nil { return nil, fmt.Errorf("failed to read unit from database: %w", err)