Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a local workspace root uses a FileSystemProvider where authority element of uri is significant, the SimpleFileDialog presented by File\Open File cannot navigate into subfolders #129296

Closed
gjsjohnmurray opened this issue Jul 24, 2021 · 2 comments · Fixed by #129310
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders simple-file-dialog Issues with simple file dialog verified Verification succeeded
Milestone

Comments

@gjsjohnmurray
Copy link
Contributor

Issue Type: Bug

The problem seems to lie in this code:

private remoteUriFrom(path: string): URI {
if (!path.startsWith('\\\\')) {
path = path.replace(/\\/g, '/');
}
const uri: URI = this.scheme === Schemas.file ? URI.file(path) : URI.from({ scheme: this.scheme, path });
// If the default scheme is file, then we don't care about the remote authority
const authority = uri.scheme === Schemas.file ? undefined : this.remoteAuthority;
return resources.toLocalResource(uri, authority,
// If there is a remote authority, then we should use the system's default URI as the local scheme.
// If there is *no* remote authority, then we should use the default scheme for this dialog as that is already local.
authority ? this.pathService.defaultUriScheme : uri.scheme);
}

When the workspace is a local one, this.remoteAuthority is undefined, so the returned uri has authority: ''

I intend to prepare a variant of the MemFS sample to demonstrate the problem.

VS Code version: Code - Insiders 1.59.0-insider (0448522, 2021-07-23T19:21:12.120Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

gjsjohnmurray added a commit to gjsjohnmurray/vscode-extension-samples that referenced this issue Jul 24, 2021
@gjsjohnmurray
Copy link
Contributor Author

https://github.com/gjsjohnmurray/vscode-extension-samples/tree/show-129296 contains a modified fsprovider-sample in which the MemFS files are generated with uris of the form memfs://dummyauthority/... instead of the usual memfs:/...

To reproduce the issue:

  1. Clone https://github.com/gjsjohnmurray/vscode-extension-samples/tree/show-129296

  2. Open the fsprovider-sample folder

  3. Build and run the extension

  4. Run the command MemFS: Setup Workspace

  5. Run MemFS: Create Files

  6. Expand the root folder to confirm files are present:
    image

  7. Use Ctrl/Cmd+O to open the simple file dialog, which correctly shows the same folders and files:
    image

  8. Select any of the three folders and observe the error message:
    image

This arises because of the following check in the modified sample:

    private _lookup(uri: vscode.Uri, silent: boolean): Entry | undefined {
        if (uri.authority !== 'dummyauthority') {
            throw vscode.FileSystemError.FileNotFound(uri);
        }

(https://github.com/gjsjohnmurray/vscode-extension-samples/blob/fb27d812ee30ce44ba413a60b0b58ee5ef59ae13/fsprovider-sample/src/fileSystemProvider.ts#L158-L161)

In the case of my own FSP extension, only the loss of the authority element of the uri is significant, but it is conceivable that other FSPs rely on query or fragment. I think SimpleFileDialog loses those elements too.

@gjsjohnmurray
Copy link
Contributor Author

it is conceivable that other FSPs rely on query or fragment. I think SimpleFileDialog loses those elements too.

An example of one relying on query is referenced in #128151, which is about how the Explorer tree mishandles query, so pinging @bpasero here too.

gjsjohnmurray added a commit to gjsjohnmurray/vscode that referenced this issue Jul 24, 2021
@alexr00 alexr00 added this to the August 2021 milestone Jul 28, 2021
@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug simple-file-dialog Issues with simple file dialog labels Jul 28, 2021
@sandy081 sandy081 added the verified Verification succeeded label Aug 25, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders simple-file-dialog Issues with simple file dialog verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@gjsjohnmurray @sandy081 @alexr00 and others