Skip to content

Commit a88324a

Browse files
committed
fix: clean up directory separators before path combine
1 parent 09e0948 commit a88324a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ReportGenerator.Core/Parser/Preprocessing/CoberturaReportPreprocessor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ internal void Execute(XContainer report)
7171
continue;
7272
}
7373

74-
string path = Path.Combine(sources[0], fileNameAttribute.Value)
75-
.Replace('\\', Path.DirectorySeparatorChar)
76-
.Replace('/', Path.DirectorySeparatorChar);
74+
string sourcePath = sources[0].Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
75+
string fileName = fileNameAttribute.Value.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
76+
string path = Path.Combine(sourcePath, fileName);
7777
fileNameAttribute.Value = path;
7878
}
7979
}
@@ -90,9 +90,9 @@ internal void Execute(XContainer report)
9090

9191
foreach (var source in sources)
9292
{
93-
string path = Path.Combine(source, fileNameAttribute.Value)
94-
.Replace('\\', Path.DirectorySeparatorChar)
95-
.Replace('/', Path.DirectorySeparatorChar);
93+
string sourcePath = source.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
94+
string fileName = fileNameAttribute.Value.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
95+
string path = Path.Combine(sourcePath, fileName);
9696

9797
if (File.Exists(path))
9898
{

0 commit comments

Comments
 (0)