From 97b8da9d104a8f815d980745d1a07e8e707206fa Mon Sep 17 00:00:00 2001 From: Hao Zhang Date: Thu, 25 Nov 2021 12:46:58 +0800 Subject: [PATCH] fix(logs): copy issues caused by extra CR (#6150) --- app/docker/components/log-viewer/logViewerController.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/docker/components/log-viewer/logViewerController.js b/app/docker/components/log-viewer/logViewerController.js index 2c8320664..22cc69911 100644 --- a/app/docker/components/log-viewer/logViewerController.js +++ b/app/docker/components/log-viewer/logViewerController.js @@ -24,13 +24,13 @@ angular.module('portainer.docker').controller('LogViewerController', [ }; this.copy = function () { - clipboard.copyText(this.state.filteredLogs.map((log) => log.line).join('')); + clipboard.copyText(this.state.filteredLogs.map((log) => log.line).join(NEW_LINE_BREAKER)); $('#refreshRateChange').show(); $('#refreshRateChange').fadeOut(2000); }; this.copySelection = function () { - clipboard.copyText(this.state.selectedLines.join('')); + clipboard.copyText(this.state.selectedLines.join(NEW_LINE_BREAKER)); $('#refreshRateChange').show(); $('#refreshRateChange').fadeOut(2000); }; @@ -49,7 +49,8 @@ angular.module('portainer.docker').controller('LogViewerController', [ }; this.downloadLogs = function () { - // To make the feature of downloading container logs working both on Windows and Linux, we need to use correct new line breakers on corresponding OS. + // To make the feature of downloading container logs working both on Windows and Linux, + // we need to use correct new line breakers on corresponding OS. const data = new Blob([_.reduce(this.state.filteredLogs, (acc, log) => acc + log.line + NEW_LINE_BREAKER, '')]); FileSaver.saveAs(data, this.resourceName + '_logs.txt'); };