MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveDownloadFileName

Function resolveDownloadFileName

src/platforms/install-source.ts:242–250  ·  view source on GitHub ↗
(response: Response, parsedUrl: URL)

Source from the content-addressed store, hash-verified

240}
241
242function resolveDownloadFileName(response: Response, parsedUrl: URL): string {
243 const contentDisposition = response.headers.get('content-disposition');
244 const filenameMatch = contentDisposition?.match(/filename\*?=(?:UTF-8'')?"?([^";]+)"?/i);
245 const headerName = filenameMatch?.[1]?.trim();
246 if (headerName) return path.basename(headerName);
247 const urlName = path.basename(parsedUrl.pathname);
248 if (urlName) return urlName;
249 return 'downloaded-artifact.bin';
250}
251
252export function isBlockedSourceHostname(hostname: string): boolean {
253 if (!hostname) return true;

Callers 1

downloadToTempFileFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected