@@ -44,7 +44,7 @@ public List<CodeQuality> Convert()
4444 Severity = GetSeverity ( result . Level ) ,
4545 Location = new ( )
4646 {
47- Path = GetPath ( pathRoot , begin ) ,
47+ Path = GetPathOld ( pathRoot , begin ) ,
4848 Lines = new ( ) { Begin = begin . ResultFile . Region . StartLine }
4949 } ,
5050 Fingerprint = Common . GetHash (
@@ -62,14 +62,14 @@ public List<CodeQuality> Convert()
6262 return cqrs ;
6363 }
6464
65- private static string GetPath ( string ? pathRoot , LocationVersionOne begin )
65+ private static string GetPathOld ( string ? pathRoot , LocationVersionOne begin )
6666 {
6767 // nullability says Uri is always set, but there are tools which omit this.
6868 if ( begin . ResultFile . Uri == null )
6969 {
7070 Log . Error (
71- "There is no valid Path for the issue {@Region}, cannot create a path. Check the source sarif for missing physicalLocation.uri" ,
72- begin . ResultFile . Region
71+ "There is no valid Path for the issue {@Region}, cannot create a path. Check the source sarif for missing physicalLocation.uri" ,
72+ begin . ResultFile . Region
7373 ) ;
7474 return "noPathInSourceSarif" ;
7575 }
@@ -81,21 +81,13 @@ private static string GetPath(string? pathRoot, LocationVersionOne begin)
8181
8282 if ( string . IsNullOrWhiteSpace ( pathRoot ) )
8383 {
84- return NormalizeSeparators ( begin . ResultFile . Uri . LocalPath . Replace ( @"\\ ", @"\" ) ) ;
84+ return begin . ResultFile . Uri . LocalPath . Replace ( "// ", " \\ " ) ;
8585 }
86-
87- var uri = GetUri ( pathRoot ) ;
88- var absolutePath = begin . ResultFile . Uri . LocalPath ;
89- var rootPath = uri . LocalPath ;
90-
91- if ( absolutePath . StartsWith ( rootPath ) )
92- {
93- return NormalizeSeparators ( absolutePath [ rootPath . Length ..] ) ;
94- }
95-
96- return NormalizeSeparators ( begin . ResultFile . Uri . MakeRelativeUri ( uri ) . ToString ( ) ) ;
86+ var rootUri = GetUri ( pathRoot ) ;
87+ return rootUri . MakeRelativeUri ( begin . ResultFile . Uri ) . ToString ( ) . Replace ( "//" , "\\ " ) ;
9788 }
9889
90+
9991 private static Uri GetUri ( string pathRoot )
10092 {
10193 if ( Path . IsPathRooted ( pathRoot ) )
0 commit comments