MCPcopy Create free account
hub / github.com/Hello-Application-XH/HelloGML / checkFileUrl

Function checkFileUrl

src/chat.ts:708–717  ·  view source on GitHub ↗
(fileUrl: string)

Source from the content-addressed store, hash-verified

706}
707
708async function checkFileUrl(fileUrl: string) {
709 if (isBASE64Data(fileUrl)) return;
710 const response = await fetch(fileUrl, { method: "HEAD" });
711 if (response.status >= 400) throw new Error(`File ${fileUrl} is not valid: [${response.status}] ${response.statusText}`);
712 const contentLength = response.headers.get("content-length");
713 if (contentLength) {
714 const fileSize = parseInt(contentLength, 10);
715 if (fileSize > FILE_MAX_SIZE) throw new Error(`File ${fileUrl} exceeds size limit`);
716 }
717}
718
719async function uploadFile(fileUrl: string, refreshToken: string, isVideoImage = false) {
720 await checkFileUrl(fileUrl);

Callers 1

uploadFileFunction · 0.85

Calls 2

isBASE64DataFunction · 0.90
fetchFunction · 0.85

Tested by

no test coverage detected