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

fix: ShowItemUsingFileManager should escape path in Linux #40527

Merged
merged 1 commit into from Nov 20, 2023

Conversation

hsfzxjy
Copy link
Contributor

@hsfzxjy hsfzxjy commented Nov 15, 2023

Description of Change

According to https://edeproject.org/spec/file-uri-spec.txt , strings passed to org.freedesktop.FileManager1.ShowItems are regarded as escaped file paths:

The specification for file: URIs, RFC2396[1] and RFC1738[2] says that
file URIs are of the form:
file://<hostname>/<path>

Where the hostname and path parts can contain a limited subset of
ASCII characters, representing their ASCII values, and any other bytes
escaped by using a % followed by a two digit hex value. As a special
case the hostname part can be "localhost" or empty meaning the machine
the URI is being interpreted on.

Hence, we should escape the file path passed in before sending it to dbus.

This will fix microsoft/vscode#198045 .

Checklist

Release Notes

Notes: Fixed file paths passed to shell.showItemInFolder not being escaped in Linux.

Copy link

welcome bot commented Nov 15, 2023

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Nov 15, 2023
Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

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

Thanks!

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/26-x-y PR should also be added to the "26-x-y" branch. target/27-x-y PR should also be added to the "27-x-y" branch. target/28-x-y PR should also be added to the "28-x-y" branch. labels Nov 15, 2023
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Nov 16, 2023
@zcbenz zcbenz merged commit 2c03b8f into electron:main Nov 20, 2023
23 of 24 checks passed
Copy link

welcome bot commented Nov 20, 2023

Congrats on merging your first pull request! 🎉🎉🎉

Copy link

release-clerk bot commented Nov 20, 2023

Release Notes Persisted

Fixed file paths passed to shell.showItemInFolder not being escaped in Linux.

@trop
Copy link
Contributor

trop bot commented Nov 20, 2023

I have automatically backported this PR to "26-x-y", please check out #40560

@trop trop bot added in-flight/26-x-y and removed target/26-x-y PR should also be added to the "26-x-y" branch. labels Nov 20, 2023
@trop
Copy link
Contributor

trop bot commented Nov 20, 2023

I have automatically backported this PR to "27-x-y", please check out #40561

@trop
Copy link
Contributor

trop bot commented Nov 20, 2023

I have automatically backported this PR to "28-x-y", please check out #40562

@trop trop bot added in-flight/27-x-y in-flight/28-x-y and removed target/27-x-y PR should also be added to the "27-x-y" branch. target/28-x-y PR should also be added to the "28-x-y" branch. labels Nov 20, 2023
@hsfzxjy hsfzxjy deleted the fix-linux-path-escape branch November 20, 2023 01:22
@trop trop bot added merged/28-x-y PR was merged to the "28-x-y" branch. and removed in-flight/28-x-y labels Nov 21, 2023
@trop trop bot added the merged/27-x-y PR was merged to the "27-x-y" branch. label Nov 30, 2023
@trop trop bot removed the in-flight/27-x-y label Nov 30, 2023
MrHuangJser pushed a commit to MrHuangJser/electron that referenced this pull request Dec 11, 2023
@trop trop bot added merged/26-x-y PR was merged to the "26-x-y" branch. and removed in-flight/26-x-y labels Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/26-x-y PR was merged to the "26-x-y" branch. merged/27-x-y PR was merged to the "27-x-y" branch. merged/28-x-y PR was merged to the "28-x-y" branch. semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad escaping of path for command.revealFileInOS
4 participants