Merge branch 'main' into feature-dialog-cover

This commit is contained in:
Randall Morey authored and GitHub committed 2021-04-09 11:45:32 -04:00
commit b5a791d618
3 files changed
+17 -1

No files matched your search

+2 -1
View File
@@ -6,7 +6,8 @@ Canonical reference for changes, improvements, and bugfixes for Boundary Desktop
### Bug Fixes
- ui: Trigger zoom-in menu option on keyboard shortcut. ([PR](https://github.com/hashicorp/boundary-ui/pull/505))
- Trigger zoom-in menu option on keyboard shortcut. ([PR](https://github.com/hashicorp/boundary-ui/pull/505))
- Boundary Desktop will accept origins with or without trailing slashes. ([PR](https://github.com/hashicorp/boundary-ui/pull/519))
## v1.0.0-beta [CLI 0.1.8] (2021.03.10)
+4
View File
@@ -63,6 +63,10 @@ export default class OriginService extends Service {
typeof origin === 'string'
);
try {
// 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.replace(/\/*$/, '');
this.adapter.host = origin;
this.rendererOrigin = origin;
if (origin !== (await this.mainOrigin)) {
@@ -24,4 +24,15 @@ module('Unit | Service | origin', function (hooks) {
assert.equal(service.adapter.host, window.location.origin);
});
});
test('drops trailing slashes 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);
});
});