Skip to content

Commit 0e7ccad

Browse files
committed
Revert "fix: delete unique-db patch"
This reverts commit ca0506c.
1 parent 77dfdae commit 0e7ccad

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ logout.diff
1010
store-socket.diff
1111
proxy-uri.diff
1212
github-auth.diff
13+
unique-db.diff
1314
local-storage.diff
1415
service-worker.diff
1516
sourcemaps.diff

patches/unique-db.diff

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Prevent state collisions
2+
3+
Previously if you opened different workspaces that had the same filesystem path
4+
(for example if you have /home/coder on two different machines that are both
5+
accessed through the same host) they would conflict with each other. This
6+
ensures that different browser paths will be unique (for example /workspace1 and
7+
/workspace2).
8+
9+
The easiest way to test is to open files in the same workspace using both / and
10+
/vscode and make sure they are not interacting with each other.
11+
12+
Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
13+
===================================================================
14+
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
15+
+++ code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
16+
@@ -17,6 +17,7 @@ import { AbstractStorageService, isProfi
17+
import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile';
18+
import { IAnyWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
19+
import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
20+
+import { hash } from 'vs/base/common/hash';
21+
22+
export class BrowserStorageService extends AbstractStorageService {
23+
24+
@@ -67,7 +68,11 @@ export class BrowserStorageService exten
25+
return `global-${this.profileStorageProfile.id}`;
26+
}
27+
case StorageScope.WORKSPACE:
28+
- return this.payload.id;
29+
+ // Add a unique ID based on the current path for per-workspace databases.
30+
+ // This prevents workspaces on different machines that share the same domain
31+
+ // and file path from colliding (since it does not appear IndexedDB can be
32+
+ // scoped to a path) as long as they are hosted on different paths.
33+
+ return this.payload.id + '-' + hash(location.pathname.toString().replace(/\/$/, "")).toString(16);
34+
}
35+
}
36+

0 commit comments

Comments
 (0)