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

Ensure that showOpenDialog returns correct file URI #13208

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

tortmayr
Copy link
Contributor

What it does

Use URI.file instead of manually reconstructing the URI from the received file path in plugin ext. This ensures that directories or files that contain a hash are not wrongly added to the fragment component of the URI and aligns it with the expected behavior of VS Code.

Fixes #13074

Contributed on behalf of ST Microelectronics

How to test

Follow instructions described in #13074
When opening a file or folder with a "#" in it the received URI should now look as expected. i.e:

{
scheme: 'file',
path: '/C:/example/#path'
fragment: ''
}

instead of

{
scheme: 'file',
path: '/C:/example/'
fragment: 'path'
}

Follow-ups

Review checklist

Reminder for reviewers

Use `URI.file` instead of manually reconstructing the URI from the received file path in plugin ext.
This ensures that directories or files that contain a hash are not wrongly added to the fragment component of the URI and aligns it with the expected behavior of VS Code.

Fixes eclipse-theia#13074

Contributed on behalf of ST Microelectronics
@msujew msujew added the file dialog issues related to the file dialog label Jan 9, 2024
@msujew
Copy link
Member

msujew commented Jan 24, 2024

@tortmayr I'll take a look at this. Can you provide a minimal extension to reproduce this?

@tortmayr
Copy link
Contributor Author

Sure thing:
Here is the extension + source code:
theia13074.zip

This opens a file dialog on startup.
Select and open a folder / file path that includes a hash (#) (e.g. 'c:/example/#path').
Inspect the received vscode.Uri object properties. (Its logged in the backend).
On master you can observe that the folder name after the # is incorrectly added to the fragment section of the URI.
With this change this behavior is fixed and the URI is correctly constructed and behaves the same as in VS Code.

@msujew msujew requested review from msujew and removed request for jonah-iden January 29, 2024 17:05
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, looks good to me 👍

@tortmayr tortmayr merged commit 8b00354 into eclipse-theia:master Feb 29, 2024
14 checks passed
@jfaltermeier jfaltermeier added this to the 1.48.0 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file dialog issues related to the file dialog
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

showOpenDialog() returns object with path and fragment properties different from VS Code
3 participants