From e269cc4f6311cc4fdaf3b20f6d87c5b280de6d6e Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Sat, 21 Nov 2020 17:58:34 -0800 Subject: [PATCH] Keep spaces. Maybe fixes #838 (#840) --- assets/components/LogEventSource.spec.js | 18 ++++++++++-------- assets/components/LogEventSource.vue | 2 +- docker/client.go | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/assets/components/LogEventSource.spec.js b/assets/components/LogEventSource.spec.js index b0f4f2b9..9e089cc6 100644 --- a/assets/components/LogEventSource.spec.js +++ b/assets/components/LogEventSource.spec.js @@ -81,7 +81,7 @@ describe("", () => { expect(messageWithoutKey).toMatchInlineSnapshot(` Object { "date": 2019-06-12T10:55:42.459Z, - "message": "\\"This is a message.\\"", + "message": " \\"This is a message.\\"", } `); }); @@ -98,7 +98,7 @@ describe("", () => { expect(messageWithoutKey).toMatchInlineSnapshot(` Object { "date": 2020-04-27T10:35:43.272Z, - "message": "xxxxx", + "message": " xxxxx", } `); }); @@ -116,7 +116,7 @@ describe("", () => { expect(messageWithoutKey).toMatchInlineSnapshot(` Object { "date": 2019-06-12T10:55:42.459Z, - "message": "\\"This is a message.\\"", + "message": " \\"This is a message.\\"", } `); }); @@ -124,7 +124,9 @@ describe("", () => { describe("render html correctly", () => { const RealDate = Date; beforeAll(() => { - global.Date = class extends RealDate { + global.Date = class extends ( + RealDate + ) { constructor(arg) { if (arg) { return new RealDate(arg); @@ -144,7 +146,7 @@ describe("", () => { await wrapper.vm.$nextTick(); expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
    -
  • "This is a message."
  • +
  • "This is a message."
`); }); @@ -159,7 +161,7 @@ describe("", () => { await wrapper.vm.$nextTick(); expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
    -
  • blackwhite
  • +
  • blackwhite
`); }); @@ -174,7 +176,7 @@ describe("", () => { await wrapper.vm.$nextTick(); expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
    -
  • <test>foo bar</test>
  • +
  • <test>foo bar</test>
`); }); @@ -192,7 +194,7 @@ describe("", () => { await wrapper.vm.$nextTick(); expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
    -
  • This is a test <hi></hi>
  • +
  • This is a test <hi></hi>
`); }); diff --git a/assets/components/LogEventSource.vue b/assets/components/LogEventSource.vue index b6366f40..9679b69d 100644 --- a/assets/components/LogEventSource.vue +++ b/assets/components/LogEventSource.vue @@ -84,7 +84,7 @@ export default { } const key = data.substring(0, i); const date = new Date(key); - const message = data.substring(i).trim(); + const message = data.substring(i); return { key, date, message }; }, }, diff --git a/docker/client.go b/docker/client.go index 2050a950..391f7269 100644 --- a/docker/client.go +++ b/docker/client.go @@ -145,7 +145,7 @@ func logReader(reader io.ReadCloser, tty bool) func() (string, error) { if err != nil { return "", err } - return strings.TrimSpace(buffer.String()), nil + return buffer.String(), nil } }