Skip to content

Commit

Permalink
cleaned up state url credential fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Nov 6, 2023
1 parent 3c8cab0 commit 1901476
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/neuroglancer/datasource/state_share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export class StateShare extends RefCounted { // call it a widget? no because it
body: JSON.stringify(viewer.state.toJSON())
}, responseJson)
.then((res) => {
const stateUrl = new URL(res);
const stateUrlWithoutProtocol = stateUrl.toString().split(stateUrl.protocol)[1];
const stateUrlProtcol = new URL(res).protocol;
const stateUrlWithoutProtocol = res.substring(stateUrlProtcol.length);
const stateUrlWithCredentialsProtocol = `${protocol}${stateUrlWithoutProtocol}`;
const link = `${window.location.origin}/#!${stateUrlWithCredentialsProtocol}`;
navigator.clipboard.writeText(link).then(() => {
Expand Down

0 comments on commit 1901476

Please sign in to comment.