File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -653,23 +653,23 @@ export const createMcpServer = (): McpServerWrapper => {
653653 const { files, outputType } = ZipResourcesInputSchema . parse ( args ) ;
654654 const zip = new JSZip ( ) ;
655655
656- for ( const [ fileName , fileUrlString ] of Object . entries ( files ) ) {
656+ for ( const [ fileName , urlString ] of Object . entries ( files ) ) {
657657 try {
658- const fileUrl = new URL ( fileUrlString ) ;
659- if ( fileUrl . protocol !== 'http:' && fileUrl . protocol !== 'https:' && fileUrl . protocol !== 'data:' ) {
660- throw new Error ( `Unsupported URL protocol for ${ fileUrlString } . Only http, https, and data URLs are supported.` ) ;
658+ const url = new URL ( urlString ) ;
659+ if ( url . protocol !== 'http:' && url . protocol !== 'https:' && url . protocol !== 'data:' ) {
660+ throw new Error ( `Unsupported URL protocol for ${ urlString } . Only http, https, and data URLs are supported.` ) ;
661661 }
662- const response = await fetch ( fileUrl ) ;
662+ const response = await fetch ( url ) ;
663663 if ( ! response . ok ) {
664664 throw new Error (
665- `Failed to fetch ${ fileUrl } : ${ response . statusText } `
665+ `Failed to fetch ${ url } : ${ response . statusText } `
666666 ) ;
667667 }
668668 const arrayBuffer = await response . arrayBuffer ( ) ;
669669 zip . file ( fileName , arrayBuffer ) ;
670670 } catch ( error ) {
671671 throw new Error (
672- `Error fetching file ${ fileUrl } : ${ error instanceof Error ? error . message : String ( error ) } `
672+ `Error fetching file ${ urlString } : ${ error instanceof Error ? error . message : String ( error ) } `
673673 ) ;
674674 }
675675 }
You can’t perform that action at this time.
0 commit comments