fix(frontend): fold sockopt v6only into V6Only on inbound load (#6453)

Prevents duplicate keys and an unreachable switch when Advanced/API configs store lowercase v6only (#6421).
This commit is contained in:
mrchatam
2026-09-12 13:21:52 +03:30
committed by GitHub
parent 6a159683d5
commit 958d7f138e

View File

@@ -184,9 +184,17 @@ export function rawInboundToFormValues(row: RawInboundRow): InboundFormValues {
}
const so = streamRecord.sockopt;
if (so && typeof so === 'object' && !Array.isArray(so)) {
const parsed = SockoptStreamSettingsSchema.safeParse(so);
const raw = { ...(so as Record<string, unknown>) };
// Imported/API configs may use lowercase v6only; the form key is V6Only.
if ('v6only' in raw) {
if (!('V6Only' in raw)) raw.V6Only = Boolean(raw.v6only);
delete raw.v6only;
}
const parsed = SockoptStreamSettingsSchema.safeParse(raw);
if (parsed.success) {
streamRecord.sockopt = { ...(so as Record<string, unknown>), ...parsed.data };
streamRecord.sockopt = { ...raw, ...parsed.data };
} else {
streamRecord.sockopt = raw;
}
}
}