@@ -44,7 +44,7 @@ public List<CodeQuality> Convert()
44
44
Severity = GetSeverity ( result . Level ) ,
45
45
Location = new ( )
46
46
{
47
- Path = GetPath ( pathRoot , begin ) ,
47
+ Path = GetPathOld ( pathRoot , begin ) ,
48
48
Lines = new ( ) { Begin = begin . ResultFile . Region . StartLine }
49
49
} ,
50
50
Fingerprint = Common . GetHash (
@@ -62,14 +62,14 @@ public List<CodeQuality> Convert()
62
62
return cqrs ;
63
63
}
64
64
65
- private static string GetPath ( string ? pathRoot , LocationVersionOne begin )
65
+ private static string GetPathOld ( string ? pathRoot , LocationVersionOne begin )
66
66
{
67
67
// nullability says Uri is always set, but there are tools which omit this.
68
68
if ( begin . ResultFile . Uri == null )
69
69
{
70
70
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
73
73
) ;
74
74
return "noPathInSourceSarif" ;
75
75
}
@@ -81,21 +81,13 @@ private static string GetPath(string? pathRoot, LocationVersionOne begin)
81
81
82
82
if ( string . IsNullOrWhiteSpace ( pathRoot ) )
83
83
{
84
- return NormalizeSeparators ( begin . ResultFile . Uri . LocalPath . Replace ( @"\\ ", @"\" ) ) ;
84
+ return begin . ResultFile . Uri . LocalPath . Replace ( "// ", " \\ " ) ;
85
85
}
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 ( "//" , "\\ " ) ;
97
88
}
98
89
90
+
99
91
private static Uri GetUri ( string pathRoot )
100
92
{
101
93
if ( Path . IsPathRooted ( pathRoot ) )
0 commit comments