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

Incorrect file extension detection for browser files #181746

Closed
rotu opened this issue May 7, 2023 · 2 comments · Fixed by microsoft/vscode-js-debug#1769
Closed

Incorrect file extension detection for browser files #181746

rotu opened this issue May 7, 2023 · 2 comments · Fixed by microsoft/vscode-js-debug#1769
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@rotu
Copy link

rotu commented May 7, 2023

Type: Bug

  1. Create a vite project npm init vite with a debug configuration to open in Chrome.
  2. Edit a file to trigger Hot Module Replacement.
  3. Stop the debugger on a file that has been edited.

Observe that the file is incorrectly detected as plain text and the filetype extension is wrong.

VS Code version: Code 1.78.0 (252e546, 2023-05-03T20:15:29.774Z)
OS version: Darwin arm64 22.5.0
Modes:
Sandboxed: No

System Info
Item Value
CPUs Apple M1 (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 4, 5
Memory (System) 16.00GB (0.24GB free)
Process Argv vite-project
Screen Reader no
VM 0%
Extensions: none
@rotu
Copy link
Author

rotu commented May 7, 2023

Screenshot 2023-05-06 at 23 52 08

Screenshot 2023-05-06 at 23 52 35

The issue appears to be twofold:

  1. Filetype detection is based on the URL, not the content-type header a file is served with
  2. The filename is not stripped of query parameters when detecting the file name

@rotu
Copy link
Author

rotu commented May 7, 2023

This appears to be mitigated (at least for my use case) by setting "enableContentValidation": false in the launch configuration, which allows VSCode to associate URLs more leniently with files (where I assume it uses the filename instead of the URL for filetype detection).

@rotu rotu changed the title Incorrect File extension detection Incorrect file extension detection for browser files May 7, 2023
@roblourens roblourens assigned connor4312 and unassigned roblourens May 13, 2023
@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels May 15, 2023
connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Aug 1, 2023
connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Aug 1, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 16, 2023
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 debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants