Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

sourcelink test does not match URLs correctly #386

Open
tmat opened this issue Jul 8, 2019 · 0 comments · May be fixed by #389
Open

sourcelink test does not match URLs correctly #386

tmat opened this issue Jul 8, 2019 · 0 comments · May be fixed by #389

Comments

@tmat
Copy link
Collaborator

tmat commented Jul 8, 2019

This function does not handle multiple source link entries correctly: https://github.com/ctaggart/SourceLink/blob/master/dotnet-sourcelink/Program.cs#L477

Consider, for example, the following source link JSON:

{
  "documents":
  {
    "/_/*":"https://raw.githubusercontent.com/aspnet/AspNetCore/0049c5899ca78e8fef7d77b355b555b793bf6616/*",
    "/_/src/submodules/googletest/*":"https://raw.githubusercontent.com/google/googletest/4e4df226fc197c0dda6e37f5c8c3845ca1e73a49/*",
    "/_/src/submodules/MessagePack-CSharp/*":"https://raw.githubusercontent.com/aspnet/MessagePack-CSharp/8861abdde93a3b97180ac3b2eafa33459ad52392/*"
  }
}

and a document path in the PDB:

/_/src/submodules/MessagePack-CSharp/src/MessagePack/SequencePool.cs

This path should match the last pattern /_/src/submodules/MessagePack-CSharp/* but it matches the first one.

The longest matching patter should be used.

See https://github.com/dotnet/designs/blob/master/accepted/diagnostics/source-link.md:

Source Link JSON may contain multiple relative and/or absolute mappings in any order. They will be resolved in order from most specific to least specific. Here is an example of a valid Source Link JSON for an arbitrary project structure

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant