mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Make sure we create a unique working copy resource for each custom editor resource
Fixes #106547 This switching the working copy resource for custom editors to use an encoded path instead of the resource's original path. This fixes a few problems: - Fixes a bug where two resources with the same path (but different schemes or authorities) would be considered the same - Fixes a bug where windows style paths (`c:\path`) would cause issues. This is the root cause of #106547 - Fixes a bug where the viewType was used as the raw authority. If the view type contains invalid characters, this would have caused issues
This commit is contained in:
@@ -346,10 +346,12 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
|
||||
}
|
||||
|
||||
private static toWorkingCopyResource(viewType: string, resource: URI) {
|
||||
const authority = viewType.replace(/[^a-z0-9\-_]/gi, '-');
|
||||
const path = '/' + btoa(resource.with({ query: null, fragment: null }).toString(true));
|
||||
return URI.from({
|
||||
scheme: Schemas.vscodeCustomEditor,
|
||||
authority: viewType,
|
||||
path: resource.path,
|
||||
authority: authority,
|
||||
path: path,
|
||||
query: JSON.stringify(resource.toJSON()),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user