Skip to content

Commit c64f09f

Browse files
densmoeclaude
andcommitted
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 <noreply@anthropic.com>
1 parent d1b17a4 commit c64f09f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sdk/mpr/reader_documents.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,9 @@ func (r *Reader) GetRawUnit(id model.ID) (map[string]any, error) {
462462
return nil, fmt.Errorf("failed to read unit contents: %w", err)
463463
}
464464
} else {
465-
// V1: Read from database
466-
row := r.db.QueryRow("SELECT Contents FROM Unit WHERE UnitID = ?", string(id))
465+
// V1: Read from database — convert UUID to GUID blob for the query
466+
unitIDBlob := types.UUIDToBlob(string(id))
467+
row := r.db.QueryRow("SELECT Contents FROM Unit WHERE UnitID = ?", unitIDBlob)
467468
err = row.Scan(&contents)
468469
if err != nil {
469470
return nil, fmt.Errorf("failed to read unit from database: %w", err)

0 commit comments

Comments
 (0)