Skip to content

Commit

Permalink
URI:folders with '%20' in their name can be opened
Browse files Browse the repository at this point in the history
The commit adds the encoding of URIs. After this update, we can now
open workspaces with reserved symbols like '%' in their name.
  • Loading branch information
OmarSdt-EC committed Aug 11, 2021
1 parent 1dba014 commit dc323cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export class ElectronMainApplication {
protected async openWindowWithWorkspace(workspacePath: string): Promise<BrowserWindow> {
const options = await this.getLastWindowOptions();
const [uri, electronWindow] = await Promise.all([this.createWindowUri(), this.createWindow(options)]);
electronWindow.loadURL(uri.withFragment(workspacePath).toString(true));
electronWindow.loadURL(uri.withFragment(encodeURI(workspacePath)).toString(true));
return electronWindow;
}

Expand Down
7 changes: 3 additions & 4 deletions packages/workspace/src/browser/workspace-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class WorkspaceService implements FrontendApplicationContribution {
this.toDisposeOnWorkspace.push(this.fileService.watch(uri));
this.onWorkspaceLocationChangedEmitter.fire(this._workspace);
}
this.setURLFragment(uri.path.toString());
this.setURLFragment(encodeURI(uri.path.toString()));
} else {
this.setURLFragment('');
}
Expand Down Expand Up @@ -496,17 +496,16 @@ export class WorkspaceService implements FrontendApplicationContribution {
protected reloadWindow(): void {
// Set the new workspace path as the URL fragment.
if (this._workspace !== undefined) {
this.setURLFragment(this._workspace.resource.path.toString());
this.setURLFragment(encodeURI(this._workspace.resource.path.toString()));
} else {
this.setURLFragment('');
}

window.location.reload(true);
}

protected openNewWindow(workspacePath: string): void {
const url = new URL(window.location.href);
url.hash = workspacePath;
url.hash = encodeURI(workspacePath);
this.windowService.openNewWindow(url.toString());
}

Expand Down

0 comments on commit dc323cd

Please sign in to comment.