Skip to content

fix #8903 Encode workspacePath before being used as URL hash value. #8909

Closed
shuyaqian wants to merge 2 commits intoeclipse-theia:masterfrom
shuyaqian:master
Closed

fix #8903 Encode workspacePath before being used as URL hash value. #8909
shuyaqian wants to merge 2 commits intoeclipse-theia:masterfrom
shuyaqian:master

Conversation

@shuyaqian
Copy link
Contributor

@shuyaqian shuyaqian commented Dec 29, 2020

What it does

fixes #8903
Encode workspacePath before being used as URL hash value when openNewWindow.

How to test

Review checklist

Reminder for reviewers

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @shuyaqian 👍
Before it can be accepted, please be sure to:

This is the reason for the failing ECA check.

@vince-fugnitto vince-fugnitto added bug bugs found in the application workspace issues related to the workspace labels Jan 4, 2021
Signed-off-by: shuyaqian <717749594@qq.com>
@shuyaqian
Copy link
Contributor Author

shuyaqian commented Jan 6, 2021

Thank you for your contribution @shuyaqian 👍
Before it can be accepted, please be sure to:

This is the reason for the failing ECA check.

I've added it. Thank you.

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

@shuyaqian the changes work for me when starting the example browser application, but not the electron (desktop) application.

To test you can do the following:

  • start the example-electron app: yarn start:electron
  • attempt to open a folder with %2 in the name

image

@kittaakos
Copy link
Contributor

What about this location?

window.location.hash = workspacePath;

@kittaakos
Copy link
Contributor

but not the electron (desktop) application.

I guess here is the missing part:

workspacePath = await fs.realpath(path.resolve(params.cwd, options.file));

This is quite a breaking, isn't it? I might be overlooking something, but if this is a breaking change, please include it in the changelog. Thanks!

@shuyaqian
Copy link
Contributor Author

but not the electron (desktop) application.

I guess here is the missing part:

workspacePath = await fs.realpath(path.resolve(params.cwd, options.file));

This is quite a breaking, isn't it? I might be overlooking something, but if this is a breaking change, please include it in the changelog. Thanks!

Thank you for your suggestion. I've revised it.

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

@shuyaqian sorry for taking a while to get back to the pull-request, would you mind rebasing the pull-request to the latest master, and also including an breaking change note in the changelog regarding the changes (it might be better to be transparent that urls are now encoded when opening the application from now on).

@kittaakos
Copy link
Contributor

What about this location?

window.location.hash = workspacePath;

Please also check if we need to change it here. Thanks!

Signed-off-by: shuyaqian <717749594@qq.com>
@shuyaqian
Copy link
Contributor Author

What about this location?

window.location.hash = workspacePath;

Please also check if we need to change it here. Thanks!

I've revised it, thank you very much!

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

@shuyaqian thank you for the changes! 👍
I confirmed that opening a workspace named a%20b can now be successfully opened in both the browser and electron targets.

await this.openDefaultWindow();
} else {
await this.openWindowWithWorkspace(workspacePath);
await this.openWindowWithWorkspace(encodeURI(workspacePath));
Copy link
Member

Choose a reason for hiding this comment

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

Encoding should be done when setting withFragment, not here.

@paul-marechal
Copy link
Member

@shuyaqian are this changes not useful anymore? Note that I had an unresolved comment.

@OmarSdt-EC OmarSdt-EC mentioned this pull request Aug 5, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug bugs found in the application workspace issues related to the workspace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open workspace doesn't work when folder name contain "%20"

4 participants