@@ -157,22 +157,28 @@ async function installFromMirror(
157157 abortController . abort ( ) ;
158158 } ) ;
159159
160- const artifactUrl = vscode . Uri . joinPath ( mirrorUrl , fileName ) ;
161- /** https://github.com/mlugg/setup-zig adds a `?source=github-actions` query parameter so we add our own. */
162- const artifactUrlWithQuery = artifactUrl . with ( { query : "source=vscode-zig" } ) ;
160+ /**
161+ * https://ziglang.org/download/community-mirrors/ encouraged the addition
162+ * of a `source` query parameter to specify what is making this request.
163+ * This extension is published as `ziglang.vscode-zig` so we use base it off that.
164+ */
165+ const sourceQuery = "ziglang-vscode-zig" ;
166+
167+ const artifactUrl = new URL ( fileName , mirrorUrl . toString ( ) ) ;
168+ artifactUrl . searchParams . set ( "source" , sourceQuery ) ;
163169
164- const artifactMinisignUrl = vscode . Uri . joinPath ( mirrorUrl , `${ fileName } .minisig` ) ;
165- const artifactMinisignUrlWithQuery = artifactMinisignUrl . with ( { query : "source=vscode-zig" } ) ;
170+ const artifactMinisignUrl = new URL ( `${ fileName } .minisig` , mirrorUrl . toString ( ) ) ;
171+ artifactMinisignUrl . searchParams . set ( "source" , sourceQuery ) ;
166172
167- const signatureResponse = await fetch ( artifactMinisignUrlWithQuery . toString ( ) , {
173+ const signatureResponse = await fetch ( artifactMinisignUrl , {
168174 signal : abortController . signal ,
169175 } ) ;
170176
171177 if ( signatureResponse . status !== 200 ) {
172178 throw new Error ( `${ signatureResponse . statusText } (${ signatureResponse . status . toString ( ) } )` ) ;
173179 }
174180
175- let artifactResponse = await fetch ( artifactUrlWithQuery . toString ( ) , {
181+ let artifactResponse = await fetch ( artifactUrl , {
176182 signal : abortController . signal ,
177183 } ) ;
178184
0 commit comments