Skip to content

Commit 3959774

Browse files
committed
Fix bugs
1 parent b0fa437 commit 3959774

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

src/ReportGenerator.Core/Reporting/Builders/Rendering/HtmlRenderer.cs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ void WriteSeries(TextWriter series)
11251125
this.reportTextWriter.WriteLine("var historyChartData{0} = {{", id);
11261126
this.reportTextWriter.Write(" \"series\" : [");
11271127
WriteSeries(this.reportTextWriter);
1128-
this.reportTextWriter.WriteLine("],\"");
1128+
this.reportTextWriter.WriteLine("],");
11291129

11301130
this.reportTextWriter.WriteLine(
11311131
" \"tooltips\" : [{0}]",
@@ -1580,27 +1580,33 @@ private void SaveCss(string targetDirectory)
15801580
return;
15811581
}
15821582

1583-
using (var fs = new FileStream(targetPath, FileMode.Create))
1583+
if (this.htmlMode == HtmlMode.InlineCssAndJavaScript)
15841584
{
1585-
if (this.htmlMode != HtmlMode.InlineCssAndJavaScript)
1585+
using (var fs = new FileStream(targetPath, FileMode.Create))
1586+
using (var writer = new StreamWriter(fs))
15861587
{
1587-
var builder = StringBuilderCache.Get();
1588-
using (var writer = new StringWriter(builder))
1589-
{
1590-
this.WriteCss(writer);
1591-
}
1588+
this.WriteCss(writer);
1589+
}
1590+
}
1591+
else
1592+
{
1593+
var builder = StringBuilderCache.Get();
1594+
using (var writer = new StringWriter(builder))
1595+
{
1596+
this.WriteCss(writer);
1597+
}
15921598

1593-
string css = StringBuilderCache.ToStringAndReturnToPool(builder);
1594-
var matches = Regex.Matches(css, @"url\(icon_(?<filename>.+).svg\),\surl\(data:image/svg\+xml;base64,(?<base64image>.+)\)");
1599+
string css = StringBuilderCache.ToStringAndReturnToPool(builder);
15951600

1596-
foreach (Match match in matches)
1597-
{
1598-
System.IO.File.WriteAllBytes(
1599-
Path.Combine(targetDirectory, "icon_" + match.Groups["filename"].Value + ".svg"),
1600-
Convert.FromBase64String(match.Groups["base64image"].Value));
1601-
}
1601+
System.IO.File.WriteAllText(targetPath, css);
1602+
1603+
var matches = Regex.Matches(css, @"url\(icon_(?<filename>.+).svg\),\surl\(data:image/svg\+xml;base64,(?<base64image>.+)\)");
16021604

1603-
StringBuilderCache.Return(builder);
1605+
foreach (Match match in matches)
1606+
{
1607+
System.IO.File.WriteAllBytes(
1608+
Path.Combine(targetDirectory, "icon_" + match.Groups["filename"].Value + ".svg"),
1609+
Convert.FromBase64String(match.Groups["base64image"].Value));
16041610
}
16051611
}
16061612

0 commit comments

Comments
 (0)