From 0b13c06a09df5fbbcff276a7110c398fe0a81e7d Mon Sep 17 00:00:00 2001 From: antelle Date: Sat, 14 Mar 2020 21:12:13 +0100 Subject: [PATCH] fix #1293: copying full urls --- app/scripts/views/details/details-view.js | 4 +--- app/scripts/views/fields/field-view-url.js | 4 ++++ app/scripts/views/fields/field-view.js | 22 +++++++++++----------- release-notes.md | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/scripts/views/details/details-view.js b/app/scripts/views/details/details-view.js index 0500e5a4..3aa86247 100644 --- a/app/scripts/views/details/details-view.js +++ b/app/scripts/views/details/details-view.js @@ -597,9 +597,7 @@ class DetailsView extends View { return false; } if (!window.getSelection().toString()) { - const fieldValue = editView.otpValue || editView.value; - const fieldText = - fieldValue && fieldValue.isProtected ? fieldValue.getText() : fieldValue; + const fieldText = editView.getTextValue(); if (!fieldText) { return; } diff --git a/app/scripts/views/fields/field-view-url.js b/app/scripts/views/fields/field-view-url.js index 6b193e3d..e5b65826 100644 --- a/app/scripts/views/fields/field-view-url.js +++ b/app/scripts/views/fields/field-view-url.js @@ -22,6 +22,10 @@ class FieldViewUrl extends FieldViewText { displayUrl(url) { return url.replace(this.displayUrlRegex, ''); } + + getTextValue() { + return this.fixUrl(this.value); + } } export { FieldViewUrl }; diff --git a/app/scripts/views/fields/field-view.js b/app/scripts/views/fields/field-view.js index 432fb896..da2a6cb4 100644 --- a/app/scripts/views/fields/field-view.js +++ b/app/scripts/views/fields/field-view.js @@ -82,19 +82,16 @@ class FieldView extends View { const field = this.model.name; let copyRes; if (field) { - const value = this.value || ''; - if (value && value.isProtected) { - const text = value.getText(); - if (!text) { - return; - } - if (!CopyPaste.simpleCopy) { - CopyPaste.createHiddenInput(text); - } - copyRes = CopyPaste.copy(text); - this.emit('copy', { source: this, copyRes }); + const text = this.getTextValue(); + if (!text) { return; } + if (!CopyPaste.simpleCopy) { + CopyPaste.createHiddenInput(text); + } + copyRes = CopyPaste.copy(text); + this.emit('copy', { source: this, copyRes }); + return; } if (!this.value) { return; @@ -347,6 +344,9 @@ class FieldView extends View { } getTextValue() { + if (!this.value) { + return ''; + } return this.value.isProtected ? this.value.getText() : this.value; } } diff --git a/release-notes.md b/release-notes.md index d7cf298d..971efd7b 100644 --- a/release-notes.md +++ b/release-notes.md @@ -13,6 +13,7 @@ Release notes `-` fix #1385: fixed a file watcher error on network locations `-` fix #1391: passwords imported from CSV were not hidden `-` fix #1387: fixed drag-drop for otp fields +`-` fix #1293: copying full urls ##### v1.12.3 (2019-11-06) `-` fix #1335: removed the menubar on Windows and Linux