Skip to content

Commit c41b307

Browse files
fitithwtechknowlogickwxiaoguang
authored
Case-insensitive NuGet symbol file GUID (#21409)
NuGet symbol file lookup returned 404 on Visual Studio 2019 due to case-sensitive api router. The api router should accept case-insensitive GUID. Co-authored-by: techknowlogick <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
1 parent 0e57ff7 commit c41b307

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

routers/api/packages/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func Routes(ctx gocontext.Context) *web.Route {
196196
r.Put("/symbolpackage", nuget.UploadSymbolPackage)
197197
r.Delete("/{id}/{version}", nuget.DeletePackage)
198198
}, reqPackageAccess(perm.AccessModeWrite))
199-
r.Get("/symbols/{filename}/{guid:[0-9a-f]{32}}FFFFFFFF/{filename2}", nuget.DownloadSymbolFile)
199+
r.Get("/symbols/{filename}/{guid:[0-9a-fA-F]{32}[fF]{8}}/{filename2}", nuget.DownloadSymbolFile)
200200
}, reqPackageAccess(perm.AccessModeRead))
201201
})
202202
r.Group("/npm", func() {

routers/api/packages/nuget/nuget.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func processUploadedFile(ctx *context.Context, expectedType nuget_module.Package
353353
// DownloadSymbolFile https://github.com/dotnet/symstore/blob/main/docs/specs/Simple_Symbol_Query_Protocol.md#request
354354
func DownloadSymbolFile(ctx *context.Context) {
355355
filename := ctx.Params("filename")
356-
guid := ctx.Params("guid")
356+
guid := ctx.Params("guid")[:32]
357357
filename2 := ctx.Params("filename2")
358358

359359
if filename != filename2 {

tests/integration/api_packages_nuget_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ AAAjQmxvYgAAAGm7ENm9SGxMtAFVvPUsPJTF6PbtAAAAAFcVogEJAAAAAQAAAA==`)
280280
req = AddBasicAuthHeader(req, user.Name)
281281
MakeRequest(t, req, http.StatusNotFound)
282282

283-
req = NewRequest(t, "GET", fmt.Sprintf("%s/symbols/%s/%sFFFFFFFF/%s", url, symbolFilename, symbolID, symbolFilename))
283+
req = NewRequest(t, "GET", fmt.Sprintf("%s/symbols/%s/%sFFFFffff/%s", url, symbolFilename, symbolID, symbolFilename))
284284
req = AddBasicAuthHeader(req, user.Name)
285285
MakeRequest(t, req, http.StatusOK)
286286

0 commit comments

Comments
 (0)