|
return uri.MakeRelativeUri(begin.ResultFile.Uri).ToString().Replace("//", "\\"); |
If the project path contains any dots, e.g.: /builds/my_group/ns.myproject the roslynator converter correctly transforms the root paths.
However the Sarif Converters make use of the MakeRelativeUri function, which will treat the string wrong.
I suggest using something more robust like
var uri = new Uri(pathRoot);
var absolutePath = begin.ResultFile.Uri.LocalPath;
var rootPath = uri.LocalPath;
if (absolutePath.StartsWith(rootPath))
{
return absolutePath.Substring(rootPath.Length).Replace("//", "\\");
}
return begin.ResultFile.Uri.MakeRelativeUri(uri).ToString().Replace("//", "\\");
dotnet_gitlab_code_quality/CodeQualityToGitlab/SarifConverters/Converter1.cs
Line 87 in 63ec7e8
If the project path contains any dots, e.g.:
/builds/my_group/ns.myprojectthe roslynator converter correctly transforms the root paths.However the Sarif Converters make use of the
MakeRelativeUrifunction, which will treat the string wrong.I suggest using something more robust like