fix: correctly unmarshal login names and metadata in user repository (#11775)

## Problem description

When calling `repository.UserRepository().Get(...)` the following error
got returned caused by scanning.

`Scan error: scanning: doing scan: scanFn: scany: scan row into struct
fields: sql: Scan error on column index 7, name "metadata": unsupported
Scan, storing driver.Value type []uint8 into type *[]*domain.Metadata`

## How the problem got solved

The issue was that json arrays were not properly unmarshalled during
scanning the rows into structs.

## Additional changes

The issue could also happen on login names, therefore it got fixed for
this field too. Other fields are not affected because we use
`json.RawMessage` for the specific user types.

## Additional information

Introduced in https://github.com/zitadel/zitadel/pull/10967
This commit is contained in:
Silvan
2026-03-06 07:56:37 +01:00
committed by GitHub
parent 07dbb48cc7
commit f89aa05e92
7 changed files with 27 additions and 14 deletions
@@ -270,7 +270,7 @@ func (i instance) UpdatedAtColumn() database.Column {
type rawInstance struct {
*domain.Instance
Domains JSONArray[domain.InstanceDomain] `json:"domains,omitempty" db:"domains"`
Domains JSONArray[*domain.InstanceDomain] `json:"domains,omitempty" db:"domains"`
}
func scanInstance(ctx context.Context, querier database.Querier, builder *database.StatementBuilder) (*domain.Instance, error) {