Skip to content

Commit 27f4330

Browse files
author
pavleli
committed
fix(web): fix create file tree error when folder named constructor.
1 parent d7f43f4 commit 27f4330

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

web/main.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,20 +2423,21 @@ class GitGraphView {
24232423
path = gitFiles[i].newFilePath.split('/');
24242424
absPath = this.currentRepo;
24252425
for (j = 0; j < path.length; j++) {
2426+
let contentName = 'graph-' + path[j];
24262427
absPath += '/' + path[j];
24272428
if (typeof this.gitRepos[absPath] !== 'undefined') {
2428-
if (typeof cur.contents[path[j]] === 'undefined') {
2429-
cur.contents[path[j]] = { type: 'repo', name: path[j], path: absPath };
2429+
if (typeof cur.contents[contentName] === 'undefined') {
2430+
cur.contents[contentName] = { type: 'repo', name: path[j], path: absPath };
24302431
}
24312432
break;
24322433
} else if (j < path.length - 1) {
2433-
if (typeof cur.contents[path[j]] === 'undefined') {
2434+
if (typeof cur.contents[contentName] === 'undefined') {
24342435
contents = {};
2435-
cur.contents[path[j]] = { type: 'folder', name: path[j], folderPath: absPath.substring(this.currentRepo.length + 1), contents: contents, open: true, reviewed: true };
2436+
cur.contents[contentName] = { type: 'folder', name: path[j], folderPath: absPath.substring(this.currentRepo.length + 1), contents: contents, open: true, reviewed: true };
24362437
}
2437-
cur = <FileTreeFolder>cur.contents[path[j]];
2438+
cur = <FileTreeFolder>cur.contents[contentName];
24382439
} else if (path[j] !== '') {
2439-
cur.contents[path[j]] = { type: 'file', name: path[j], index: i, reviewed: codeReview === null || !codeReview.remainingFiles.includes(gitFiles[i].newFilePath) };
2440+
cur.contents[contentName] = { type: 'file', name: path[j], index: i, reviewed: codeReview === null || !codeReview.remainingFiles.includes(gitFiles[i].newFilePath) };
24402441
}
24412442
}
24422443
}

0 commit comments

Comments
 (0)