fix: match scalar array properties in views

This commit is contained in:
lucaronin
2026-05-15 08:33:17 +02:00
parent 17a938f8cf
commit 7e50da7816
19 changed files with 504 additions and 136 deletions

View File

@@ -101,6 +101,17 @@ function normalizeProperties(value: unknown): VaultEntry['properties'] {
const source = recordFrom(value)
const result: VaultEntry['properties'] = {}
for (const [key, rawValue] of Object.entries(source)) {
if (Array.isArray(rawValue)) {
const values = rawValue.filter((item): item is string | number | boolean => (
typeof item === 'string'
|| typeof item === 'boolean'
|| (typeof item === 'number' && Number.isFinite(item))
))
if (values.length === rawValue.length) {
Reflect.set(result, key, values.length === 1 ? values[0] : values)
}
continue
}
if (
rawValue === null
|| typeof rawValue === 'string'