open a file on a different path but with same name fails (#208785)

Fixes #204886
This commit is contained in:
Alex Ross 2024-03-26 15:52:40 +01:00 committed by GitHub
parent 4166553e05
commit 1a54634c51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -581,7 +581,12 @@ export class SimpleFileDialog implements ISimpleFileDialog {
valueUri = this.root(this.currentFolder);
value = this.pathFromUri(valueUri);
return await this.updateItems(valueUri, true) ? UpdateResult.UpdatedWithTrailing : UpdateResult.Updated;
} else if (!resources.extUriIgnorePathCase.isEqual(this.currentFolder, valueUri) && (this.endsWithSlash(value) || (!resources.extUriIgnorePathCase.isEqual(this.currentFolder, resources.dirname(valueUri)) && resources.extUriIgnorePathCase.isEqualOrParent(this.currentFolder, resources.dirname(valueUri))))) {
} else {
const newFolderIsOldFolder = resources.extUriIgnorePathCase.isEqual(this.currentFolder, valueUri);
const newFolderIsSubFolder = resources.extUriIgnorePathCase.isEqual(this.currentFolder, resources.dirname(valueUri));
const newFolderIsParent = !newFolderIsOldFolder && resources.extUriIgnorePathCase.isEqualOrParent(this.currentFolder, resources.dirname(valueUri));
const newFolderIsUnrelated = !newFolderIsOldFolder && !newFolderIsParent && !newFolderIsSubFolder;
if (this.endsWithSlash(value) || newFolderIsParent || newFolderIsUnrelated) {
let stat: IFileStatWithPartialMetadata | undefined;
try {
stat = await this.fileService.stat(valueUri);
@ -619,6 +624,7 @@ export class SimpleFileDialog implements ISimpleFileDialog {
}
}
}
}
this.badPath = undefined;
return UpdateResult.NotUpdated;
}