File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -166,13 +166,14 @@ function ProcessNpmLink([System.Uri]$linkUri) {
166166
167167 # Handle versioned URLs: https://www.npmjs.com/package/@azure/ai-agents/v/1.1.0 -> https://registry.npmjs.org/@azure/ai-agents/1.1.0
168168 # Handle non-versioned URLs: https://www.npmjs.com/package/@azure/ai-agents -> https://registry.npmjs.org/@azure/ai-agents
169- # The regex captures the package name (which may contain a slash for scoped packages) and optionally the version
169+ # The regex captures the package name (which may contain a slash for scoped packages) and optionally the version.
170+ # Query parameters and URL fragments are excluded from the transformation.
170171 $urlString = $linkUri.ToString ()
171- if ($urlString -match ' ^https?://(?:www\.)?npmjs\.com/package/(. +)/v/(.+)$ ' ) {
172+ if ($urlString -match ' ^https?://(?:www\.)?npmjs\.com/package/([^?#] +)/v/([^?#]+) ' ) {
172173 # Versioned URL: remove the /v/ segment but keep the version
173174 $apiUrl = " https://registry.npmjs.org/$ ( $matches [1 ]) /$ ( $matches [2 ]) "
174175 }
175- elseif ($urlString -match ' ^https?://(?:www\.)?npmjs\.com/package/(.+)$ ' ) {
176+ elseif ($urlString -match ' ^https?://(?:www\.)?npmjs\.com/package/([^?#]+) ' ) {
176177 # Non-versioned URL: just replace the domain
177178 $apiUrl = " https://registry.npmjs.org/$ ( $matches [1 ]) "
178179 }
You can’t perform that action at this time.
0 commit comments