mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-01 20:31:19 +00:00
Gateway: guard base64 image size accounting
This commit is contained in:
@@ -300,7 +300,11 @@ async function resolveImagesForRequest(
|
||||
for (const url of urls) {
|
||||
const source = parseImageUrlToSource(url);
|
||||
if (source.type === "base64") {
|
||||
totalBytes += estimateBase64DecodedBytes(source.data);
|
||||
const base64Data = source.data;
|
||||
if (typeof base64Data !== "string") {
|
||||
throw new Error("image_url data URI is missing payload data");
|
||||
}
|
||||
totalBytes += estimateBase64DecodedBytes(base64Data);
|
||||
if (totalBytes > limits.maxTotalImageBytes) {
|
||||
throw new Error(
|
||||
`Total image payload too large (${totalBytes}; limit ${limits.maxTotalImageBytes})`,
|
||||
|
||||
Reference in New Issue
Block a user