mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 21:21:10 +00:00
fix: browser fill default type parity (#27662) (thanks @Uface11)
This commit is contained in:
@@ -70,18 +70,19 @@ export async function readFields(opts: {
|
||||
const rec = entry as Record<string, unknown>;
|
||||
const ref = typeof rec.ref === "string" ? rec.ref.trim() : "";
|
||||
const type = typeof rec.type === "string" ? rec.type.trim() : "";
|
||||
if (!ref || !type) {
|
||||
throw new Error(`fields[${index}] must include ref and type`);
|
||||
if (!ref) {
|
||||
throw new Error(`fields[${index}] must include ref`);
|
||||
}
|
||||
const resolvedType = type || "text";
|
||||
if (
|
||||
typeof rec.value === "string" ||
|
||||
typeof rec.value === "number" ||
|
||||
typeof rec.value === "boolean"
|
||||
) {
|
||||
return { ref, type, value: rec.value };
|
||||
return { ref, type: resolvedType, value: rec.value };
|
||||
}
|
||||
if (rec.value === undefined || rec.value === null) {
|
||||
return { ref, type };
|
||||
return { ref, type: resolvedType };
|
||||
}
|
||||
throw new Error(`fields[${index}].value must be string, number, boolean, or null`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user