microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.68k stars 29.07k forks source link

VS Code erroneously registers itself with as a .SVGZ handler #231021

Open skycommand opened 1 week ago

skycommand commented 1 week ago

Type: Bug

Upon installation on Microsoft Windows, Visual Studio Code registers itself as a handler for .svgz files. This is an egregious action because Visual Studio Code cannot handle this binary file type.

Edit (2024-10-12): I've found one part of VSCode's source code responsible for this erroneous file association: https://github.com/microsoft/vscode/blob/main/build/win32/code.iss#L1120-L1124

Steps to reproduce:

  1. Create a virtual machine with a clean version of a supported version of Windows 10

  2. Download and install VSCodeSetup-x64-1.94.1.exe. Use the defaults.

  3. Create a .svgz file on your desktop.

    The fastest way to that is to open PowerShell 5.1 and issue the following command:

    [Convert]::FromBase64String('H4sIAAAAAAAACxXMMQqEMBBG4av8zPbOGGOKJUlh5RnshN1VIa6iwfH4Krzy4/n9GHDO6b8HGnNe38yqWmhVLNvARkT4FoRj+mqznIEEgsrcUfRrn0f8ppQCvWxd984SPoHm0sGhNDDS2o44+ucRLyei7ABrAAAA') | Set-Content 'Test.svgz' -Encoding Byte
  4. Double-click the newly created .svgz file.

Expected result: Windows should inform the user that no app has been registered to handle this file type.

Actual result: Visual Studio Code launches, attempts to open the file, and fails.

VS Code version: Code 1.94.1 (e10f2369d0d9614a452462f2e01cdc4aa9486296, 2024-10-05T05:44:32.189Z) OS version: Windows_NT x64 10.0.19045 Modes:

vs-code-engineering[bot] commented 1 week ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.94.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

joshspicer commented 1 week ago

On my windows machine I am not seeing any default program set for the svgz extension Image

When I follow your repro steps, I am seeing the application selection prompt that you expect to see

Image

Perhaps your machine has been inadvertently configured to open svgz in Code? I believe you can change that setting in your Windows preferences to your application of choice.

skycommand commented 1 week ago

@joshspicer

Perhaps your machine has been inadvertently configured to open svgz in Code?

The reproduction steps that I supplied were given for a clean virtual machine with a fresh installation of Windows, not for my machine. You seem to have missed that fact. I test bugs on virtual machines so that I avoid the "baldy configured machine" trap.

On my windows machine

Perhaps your machine has been inadvertently configured that way.

skycommand commented 1 week ago

@joshspicer Hello again. I hope I'm not being a bother, but I'd like to let you know that I've found the portion of Visual Studio Code's source code responsible for this issue. I thought letting you know would let you expedite the fix:

https://github.com/microsoft/vscode/blob/main/build/win32/code.iss#L1120-L1124

And in the case you have trouble finding it, here is a screenshot to help you.

Image

And here is the outcome of said code:

Image

If there is anything else you need to know, please let me know.