Browse Source

Fix whitespace handling in proxy

fix #49 & #45
mj-deploy
Standa Lukeš 4 years ago
parent
commit
8403dc832b
  1. 1
      frontend/src/ksp-task-grabber.ts
  2. 2
      server/Ksp.WebServer/KspPageRewriter.cs

1
frontend/src/ksp-task-grabber.ts

@ -161,6 +161,7 @@ function parseTaskStatuses(doc: HTMLDocument): TaskStatus[] {
const pointsMatch = /((–|\.|\d)+) *\/ *(\d+)/.exec(pointsStr) const pointsMatch = /((–|\.|\d)+) *\/ *(\d+)/.exec(pointsStr)
if (!pointsMatch) throw new Error() if (!pointsMatch) throw new Error()
let points = +pointsMatch[2] let points = +pointsMatch[2]
// points was a dash, means 0
if (isNaN(points)) { if (isNaN(points)) {
points = 0 points = 0
} }

2
server/Ksp.WebServer/KspPageRewriter.cs

@ -16,7 +16,7 @@ namespace Ksp.WebServer
ModifyTree(document, context.Request.Path.Value.Trim('/')); ModifyTree(document, context.Request.Path.Value.Trim('/'));
var outputHtml = new StringWriter(); var outputHtml = new StringWriter();
document.ToHtml(outputHtml, new PrettyMarkupFormatter() { Indentation = "\t", NewLine = "\n" }); document.ToHtml(outputHtml, new HtmlMarkupFormatter());
return outputHtml.ToString(); return outputHtml.ToString();
} }