From 8403dc832b8a711d4e58409c75662de1f84fa39b Mon Sep 17 00:00:00 2001 From: exyi Date: Sun, 18 Oct 2020 08:27:02 +0000 Subject: [PATCH] Fix whitespace handling in proxy fix #49 & #45 --- frontend/src/ksp-task-grabber.ts | 1 + server/Ksp.WebServer/KspPageRewriter.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/ksp-task-grabber.ts b/frontend/src/ksp-task-grabber.ts index bdaf5c1..b7db634 100644 --- a/frontend/src/ksp-task-grabber.ts +++ b/frontend/src/ksp-task-grabber.ts @@ -161,6 +161,7 @@ function parseTaskStatuses(doc: HTMLDocument): TaskStatus[] { const pointsMatch = /((–|\.|\d)+) *\/ *(\d+)/.exec(pointsStr) if (!pointsMatch) throw new Error() let points = +pointsMatch[2] + // points was a dash, means 0 if (isNaN(points)) { points = 0 } diff --git a/server/Ksp.WebServer/KspPageRewriter.cs b/server/Ksp.WebServer/KspPageRewriter.cs index 75c69e2..c6aede6 100644 --- a/server/Ksp.WebServer/KspPageRewriter.cs +++ b/server/Ksp.WebServer/KspPageRewriter.cs @@ -16,7 +16,7 @@ namespace Ksp.WebServer ModifyTree(document, context.Request.Path.Value.Trim('/')); var outputHtml = new StringWriter(); - document.ToHtml(outputHtml, new PrettyMarkupFormatter() { Indentation = "\t", NewLine = "\n" }); + document.ToHtml(outputHtml, new HtmlMarkupFormatter()); return outputHtml.ToString(); }