diff --git a/addons/core/translations/notifications/en-us.yaml b/addons/core/translations/notifications/en-us.yaml index 8c915ebe0..c770b08eb 100644 --- a/addons/core/translations/notifications/en-us.yaml +++ b/addons/core/translations/notifications/en-us.yaml @@ -1,5 +1,5 @@ -create-success: Created succesfully. -save-success: Saved succesfully. +create-success: Created successfully. +save-success: Saved successfully. delete-success: Deleted successfully. add-success: Added successfully. remove-success: Removed successfully. diff --git a/ui/desktop/app/services/origin.js b/ui/desktop/app/services/origin.js index 9ca0895f2..c3e27c358 100644 --- a/ui/desktop/app/services/origin.js +++ b/ui/desktop/app/services/origin.js @@ -63,9 +63,10 @@ export default class OriginService extends Service { typeof origin === 'string' ); try { - // Silently drop trailing slashes if present. + // Trim whitespaces and silently drop trailing slashes if present. // This is important since API paths that will be appended to the origin // will include preceeding slashes already. + origin = origin.trim(); origin = origin.replace(/\/*$/, ''); this.adapter.host = origin; this.rendererOrigin = origin; diff --git a/ui/desktop/electron-app/src/app-updater.js b/ui/desktop/electron-app/src/app-updater.js index b758a6eac..a4982834d 100644 --- a/ui/desktop/electron-app/src/app-updater.js +++ b/ui/desktop/electron-app/src/app-updater.js @@ -90,7 +90,7 @@ const downloadAndInstallUpdate = async (version) => { * TODO: download progress in dialog **/ module.exports = { - run: async ({ suppressNoUpdatePrompt }) => { + run: async ({ suppressNoUpdatePrompt } = {}) => { let latestVersion; if (debug) { latestVersion = process.env.APP_UPDATER_LATEST_VERSION_TAG; @@ -104,7 +104,8 @@ module.exports = { } // Update not available - do nothing - if (!suppressNoUpdatePrompt && semver.lte(latestVersion, currentVersion)) { + if (semver.lte(latestVersion, currentVersion)) { + if (suppressNoUpdatePrompt) return; const dialogOpts = { type: 'info', icon: null, @@ -112,21 +113,20 @@ module.exports = { }; dialog.showMessageBox(dialogOpts); - return; + } else { + // Update is available - prompt for download + const dialogOpts = { + type: 'info', + buttons: ['Download', 'Later'], + icon: null, + detail: 'A new version is available for download', + }; + + dialog.showMessageBox(dialogOpts).then((returnValue) => { + if (returnValue.response === 0) { + downloadAndInstallUpdate(latestVersion); + } + }); } - - // Update is available - prompt for download - const dialogOpts = { - type: 'info', - buttons: ['Download', 'Later'], - icon: null, - detail: 'A new version is available for download', - }; - - dialog.showMessageBox(dialogOpts).then((returnValue) => { - if (returnValue.response === 0) { - downloadAndInstallUpdate(latestVersion); - } - }); }, }; diff --git a/ui/desktop/electron-app/src/spawn-promise.js b/ui/desktop/electron-app/src/spawn-promise.js index d73390f02..dc8069791 100644 --- a/ui/desktop/electron-app/src/spawn-promise.js +++ b/ui/desktop/electron-app/src/spawn-promise.js @@ -53,7 +53,7 @@ module.exports = { const jsonData = jsonify(errorStream); if (jsonData) { const error = jsonData.api_error || jsonData.error; - reject(new Error(error)); + reject(new Error(error.message)); } }); }); diff --git a/ui/desktop/tests/unit/services/origin-test.js b/ui/desktop/tests/unit/services/origin-test.js index cc6cdfa69..7c759713f 100644 --- a/ui/desktop/tests/unit/services/origin-test.js +++ b/ui/desktop/tests/unit/services/origin-test.js @@ -35,4 +35,15 @@ module('Unit | Service | origin', function (hooks) { assert.equal(service.rendererOrigin, window.location.origin); assert.equal(service.adapter.host, window.location.origin); }); + + test('trim spaces from origin on setOrigin', async function (assert) { + assert.expect(4); + sinon.stub(ipcService, 'invoke'); + await service.setOrigin(` ${window.location.origin}/ `); + assert.equal(service.rendererOrigin, window.location.origin); + assert.equal(service.adapter.host, window.location.origin); + await service.setOrigin(` ${window.location.origin} `); + assert.equal(service.rendererOrigin, window.location.origin); + assert.equal(service.adapter.host, window.location.origin); + }); });