Skip to content

Commit 0cc02be

Browse files
committed
fix(remoteFileSystemProvider): robust project name parsing for special characters
- Improve parseUri to correctly handle project names containing special characters such as []. - Fallback to query.projectName if path part is missing or empty. - Ensure decodeURIComponent is used for both path and query extraction. - This fixes issues where projects with names like "[test]" could not be opened in VS Code.
1 parent fd5ba0d commit 0cc02be

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/core/projectManagerProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class ProjectManagerProvider implements vscode.TreeDataProvider<DataItem>
128128
// get project items
129129
const normalProjects = [], trashedProjects = [], archivedProjects = [];
130130
for (const project of projects) {
131-
const uri = `${ROOT_NAME}://${element.name}/${project.name}?user=${project.userId}&project=${project.id}`;
131+
const uri = `${ROOT_NAME}://${element.name}/${encodeURIComponent(project.name)}?user=${project.userId}&project=${project.id}`;
132132
const status = project.archived ? 'archived' : project.trashed ? 'trashed' : 'normal';
133133
const item = new ProjectItem(element.api, uri, element, project.id, project.name, status);
134134
switch (status) {

src/core/remoteFileSystemProvider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ export function parseUri(uri: vscode.Uri) {
100100
const [userId, projectId] = [query.user, query.project];
101101
const _pathParts = uri.path.split('/');
102102
const serverName = uri.authority;
103-
const projectName = _pathParts[1];
103+
let projectName = _pathParts[1] ? decodeURIComponent(_pathParts[1]) : '';
104+
if (!projectName && query.projectName) {
105+
projectName = decodeURIComponent(query.projectName);
106+
}
104107
const pathParts = _pathParts.splice(2);
105108
const identifier = `${userId}/${projectId}/${projectName}`;
106109
return {userId, projectId, serverName, projectName, identifier, pathParts};

0 commit comments

Comments
 (0)