fix(FN-7143): simplify base64 validation and improve error messages

This commit is contained in:
copilot-swe-agent[bot]
2026-06-30 00:18:04 +00:00
committed by GitHub
parent 1bf8d83bc1
commit 8544b5b08b
2 changed files with 2 additions and 5 deletions

View File

@@ -325,7 +325,7 @@ export function TaskDocumentsTab({
const dialog = lightboxDialogRef.current;
const focusableElements = Array.from(dialog?.querySelectorAll<HTMLElement>(
'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',
) ?? []).filter((element) => !element.hasAttribute("disabled") && element.getAttribute("aria-hidden") !== "true");
) ?? []).filter((element) => element.getAttribute("aria-hidden") !== "true");
if (!dialog || focusableElements.length === 0) {
event.preventDefault();

View File

@@ -1514,12 +1514,9 @@ function decodeArtifactDataBase64(params: Static<typeof artifactRegisterParams>)
}
const data = Buffer.from(normalized, "base64");
if (data.length === 0 || data.toString("base64").replace(/=+$/, "") !== normalized.replace(/=+$/, "")) {
throw new Error("dataBase64 must decode to non-empty artifact bytes.");
}
if (!hasImageSignature(data, mimeType)) {
throw new Error("dataBase64 must decode to valid image bytes matching mimeType.");
throw new Error(`dataBase64 must decode to valid image bytes matching mimeType ${mimeType}.`);
}
return data;