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

VS Code takes over the association for HTML files without asking #60664

Closed
acidhelm opened this issue Oct 11, 2018 · 18 comments
Closed

VS Code takes over the association for HTML files without asking #60664

acidhelm opened this issue Oct 11, 2018 · 18 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug install-update VS Code installation and upgrade system issues linux Issues with VS Code on Linux verified Verification succeeded
Milestone

Comments

@acidhelm
Copy link

  • VSCode Version: 1.28.0, v1.29.0-insider, commit f151c46.
  • OS Version: Linux Mint 18. uname -a reports: "Linux 4.4.0-53-generic Vim modal editing #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux"

Steps to Reproduce:

  1. Double-click an HTML file to check that your browser has the association for HTML files.
  2. Run VS Code, then close it.
  3. Double-click an HTML file. It opens in VS Code instead of the browser. Close VS Code.
  4. Reset the HTML association to the browser.
  5. Run VS code, then close it.
  6. Double-click an HTML file. It opens in VS Code instead of the browser.

Does this issue occur when all extensions are disabled?: Yes

Additional info:

This bug does not happen in version 1.27.2.

When I installed 1.28.0 over 1.27.2, this error appeared in the terminal:

/usr/share/applications/code-url-handler.desktop: warning: key "MimeType" is a list and does not have a semicolon as trailing character, fixing

Installing over 1.27.2 is not necessary. I uninstalled VS Code, then installed 1.28.0, and the bug still happens.

I can work around this problem by deleting /usr/share/applications/code-url-handler.desktop. I don't know if this will have unwanted side-effects, though.

@vscodebot vscodebot bot added the insiders label Oct 11, 2018
@joaomoreno joaomoreno added the bug Issue identified by VS Code Team member as probable bug label Oct 12, 2018
@joaomoreno joaomoreno added this to the October 2018 milestone Oct 12, 2018
@joaomoreno joaomoreno added linux Issues with VS Code on Linux install-update VS Code installation and upgrade system issues labels Oct 12, 2018
@IgorKrupenja
Copy link

IgorKrupenja commented Oct 13, 2018

I can reproduce this with Ubuntu 18.04 and VSCode 1.28.1. mv /usr/share/applications/code-url-handler.desktop /usr/share/applications/code-url-handler.desktop~ does indeed help.

@ilovesusu
Copy link

ilovesusu commented Oct 17, 2018

I can reproduce this with Ubuntu 18.04 and VSCode 1.28.1. mv /usr/share/applications/code-url-handler.desktop /usr/share/applications/code-url-handler.desktop~ does indeed help.

Debian testing and VSCode 1.28.1 no effect, delete is also

o ,delete .local/share/applications/code-url-handler.desktop,does indeed help.

@blah4
Copy link

blah4 commented Oct 21, 2018

Will this problem be fixed? Or the final solution is delete .local/share/applications/code-url-handler.desktop?

@joaomoreno
Copy link
Member

It will be fixed.

@vscodebot vscodebot bot removed the insiders label Oct 23, 2018
@zaro
Copy link

zaro commented Oct 30, 2018

Same problem on Ubuntu 18.10, vscode 1.28.2 installed from .deb .
Fixed with :

sudo rm /usr/share/applications/code-url-handler.desktop

@joaomoreno
Copy link
Member

This seems to be caused by calling app.setAsDefaultProtocolClient here: https://github.com/Microsoft/vscode/blob/b7eb0f4040f4eaf72275d512c3ce431103f6e3cf/src/vs/platform/url/electron-main/electronUrlListener.ts#L45

We don't really need this call in macOS or Linux, so now we just run it for Windows.

@chrmarti
Copy link
Contributor

chrmarti commented Nov 2, 2018

The original issue doesn't repo on my Linux / Mac.

@chrmarti chrmarti added the verification-steps-needed Steps to verify are needed for verification label Nov 2, 2018
@joaomoreno
Copy link
Member

This is Linux only! Basically:

  1. Create a file.html file on the Desktop
  2. Install the Code deb package
  3. Associate file.html to open with Firefox. Verify by double clicking on it.
  4. Run Code
  5. Double click file.html. It should keep opening in Firefox.

@chrmarti
Copy link
Contributor

chrmarti commented Nov 2, 2018

1.28.2 did not associate the file with Code under Ubuntu 18.04. Trying with Fedora now.

@mzabaluev
Copy link

This occurs to me with 1.28.2 on Fedora. Installed code-1.28.2-1539736121.el7.x86_64 from the official yum repository. Every time Code is started, the XDG default for MIME type text/html gets overridden to code-url-handler.desktop. This is very annoying and invasive, don't do it from an application.

@chrmarti
Copy link
Contributor

chrmarti commented Nov 5, 2018

@mzabaluev Does it add the association back when you remove it manually? If so, could you try the latest insiders build and check if it is fixed? Thanks.

@joaomoreno joaomoreno removed the verification-steps-needed Steps to verify are needed for verification label Nov 5, 2018
@mzabaluev
Copy link

Does it add the association back when you remove it manually?

It does.

If so, could you try the latest insiders build and check if it is fixed?

It seems fixed in code-insiders-1.29.0-1541336700.

@chrmarti
Copy link
Contributor

chrmarti commented Nov 5, 2018

Thanks @mzabaluev. Marking verified.

@chrmarti chrmarti added the verified Verification succeeded label Nov 5, 2018
@acidhelm
Copy link
Author

This is fixed in 1.29, thanks!

@aral
Copy link

aral commented Dec 2, 2018

@acidhelm I’m still seeing this behaviour on Pop!_OS 18.10 (based on Ubuntu 18.10) with VSCode 1.29.1.

@yogo-chen
Copy link

OS: Ubuntu 18.04

Updating to 1.29.1 doesn't resolve the issue. Cc. @chrmarti

In my case, if I open with
$ xdg-open file.html
it will be opened in default web application set by user.

But if I open with elevated privilege
$ sudo xdg-open file.html
it will be opened in vs-code

So, I think vs-code override su(?) default html opener at the past installation.
Is there any way to revert this?

Deleting code-url-handler.desktop does help stop this vs-code popup behavior (for user with elevated privilege), but it still doesn't open the html in default web application.
I believe what users expect is it to be opened in default web application whether it opened by a normal user or with the elevated one.

@PhABC
Copy link

PhABC commented Dec 4, 2018

1.29.1 does not solve this issue for me either.

Ubuntu 16.04, using xdg-open file.html opens vscode instead of default browser.

@km333
Copy link

km333 commented Dec 6, 2018

Ubuntu 18.04.1
VS Code 1.29.1

VS Code team - this really sucks don't make me start hating this great product please
(Workaround $ sudo rm /usr/share/applications/code-url-handler.desktop still working for me btw)

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 17, 2018
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 install-update VS Code installation and upgrade system issues linux Issues with VS Code on Linux verified Verification succeeded
Projects
None yet
Development

No branches or pull requests