diff --git a/src/screen.go b/src/screen.go index cc04ddc..5566214 100644 --- a/src/screen.go +++ b/src/screen.go @@ -109,7 +109,7 @@ func showInfo(str string) { printLogOnScreen(logMsg, "info") - logAppend(strings.Replace(logMsg, " ", " ", -1)) + logAppend(logMsg) } @@ -137,7 +137,7 @@ func showDebug(str string, level int) { printLogOnScreen(logMsg, "debug") - logAppend(strings.Replace(logMsg, " ", " ", -1)) + logAppend(logMsg) } diff --git a/src/screen_test.go b/src/screen_test.go index 1b85c3c..e92ab26 100644 --- a/src/screen_test.go +++ b/src/screen_test.go @@ -106,3 +106,28 @@ func TestShowHighlightWithoutColon(t *testing.T) { } } } + +// The web UI renders log lines as text inside
, so the server must store
+// plain spaces, not HTML entities.
+func TestLogLinesContainNoHTMLEntities(t *testing.T) {
+	var oldLimit = Settings.LogEntriesRAM
+	Settings.LogEntriesRAM = 500
+	t.Cleanup(func() { Settings.LogEntriesRAM = oldLimit })
+
+	resetWebScreenLog()
+	showInfo("Version:2.2.0 Build: 0201")
+	showDebug("Buffer Status:some debug text", 0)
+
+	snap := webScreenLogSnapshot()
+	if len(snap.Log) == 0 {
+		t.Fatal("no log lines recorded")
+	}
+	if !strings.Contains(snap.Log[0], "Version:                2.2.0 Build: 0201") {
+		t.Errorf("padding should be plain spaces, got %q", snap.Log[0])
+	}
+	for _, line := range snap.Log {
+		if strings.Contains(line, " ") {
+			t.Errorf("log line contains an HTML entity: %q", line)
+		}
+	}
+}