PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.7k stars 488 forks source link

Uploading bug report from VSCode doesn't work when using copy #2409

Closed PrzemyslawKlys closed 2 years ago

PrzemyslawKlys commented 4 years ago

Issue Description

I am experiencing a problem with... uploading bug report from VSCode. If you choose to upload report you get something like this:

image

  1. When you pick open it opens up properly
  2. If you choose copy, not so much

image

Attached Logs

Follow the instructions in the README about capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.18363
VSCode 1.41.1
PowerShell Extension Version 2019.12.0

PowerShell Information

Name Value
PSVersion 5.1.18362.145
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.18362.145
BuildVersion 10.0.18362.145
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand) |Extension|Author|Version| |---|---|---| |auto-rename-tag|formulahendry|0.1.1| |azure-dark-theme|eddyw|0.2.0| |beautify|HookyQR|1.5.0| |bracket-pair-colorizer-2|CoenraadS|0.0.29| |code-settings-sync|Shan|3.4.3| |codesnap|adpyke|1.0.26| |dark-plus-material|vangware|2.2.2| |excel-to-markdown-table|csholmq|1.1.0| |gistfs|vsls-contrib|0.0.43| |github-linker|gimenete|0.2.3| |gitlens|eamodio|10.2.0| |html-preview-vscode|george-alisson|0.2.5| |markdown-all-in-one|yzhang|2.6.1| |markdown-preview-enhanced|shd101wyy|0.5.1| |markdown-shortcuts|mdickin|0.12.0| |material-icon-theme|PKief|3.9.2| |moonlight|atomiks|0.10.0| |nebula-theme|ChirtleLovesDolls|1.3.2| |pdf|tomoki1207|0.5.1| |powershell-preview|ms-vscode|2019.12.0| |project-manager|alefragnani|10.9.1| |reg|ionutvmi|1.0.1| |synthwave-x-fluoromachine|webrender|0.0.9| |theme-monokai-pro-vscode|monokai|1.1.14| |vscode-html-css|ecmel|0.2.3| |vscode-markdownlint|DavidAnson|0.33.0| |vscode-power-mode|hoovercj|2.2.0| |vscode-pull-request-github|GitHub|0.14.0| |vscode-wakatime|WakaTime|2.2.1| |vscode-yaml|redhat|0.6.1| |xml|DotJoshJohnson|2.5.0|
SydneyhSmith commented 4 years ago

@PrzemyslawKlys thanks for opening this--this is a vscode issue as they are the ones providing the dialog (we do not control the open vs copy dialog). Could you please open an issue in their repo? Thanks!

PrzemyslawKlys commented 4 years ago

The error is because the new lines in URL are not provided when you copy the URL so it all messes up. Do you think providing new lines (for URL usage) is part of your responsibility or vscode to make sure it's properly encoded?

I think they will argue that their "option" processes it properly because it simply takes the "Text" provided and converts it into a single line.

It takes the provided text with a URL and it does what it does.

If you take your code to generate this and replace all the NewLines with %0D%0A

it's going to work properly...

https://github.com/PowerShell/vscode-powershell/issues/new?body=Issue Description%0D%0A=====%0D%0AI am experiencing a problem with...%0D%0A%0D%0AAttached Logs%0D%0A=====%0D%0AFollow the instructions in the [README](https://github.com/PowerShell/vscode-powershell%23reporting-problems) about
capturing and sending logs.%0D%0A%0D%0AEnvironment Information%0D%0A=====%0D%0A

So maybe instead of pushing it to VSCode we could simply fix this code in VSCode-PowerShell addressing new lines with proper replacement code for the URL use?

PrzemyslawKlys commented 4 years ago

The code for this @SydneyhSmith is located here:

https://github.com/PowerShell/vscode-powershell/blob/b9eafbbd02808660e47adfcd94f0d47d3a460eb8/src/features/GenerateBugReport.ts#L38-L74

So if you make it one-liner with proper replacements to newlines it should work I guess? I guess I could submit PR but I have no way to test this since I've never done the development of VSCode/TypeScript.

SydneyhSmith commented 4 years ago

@PrzemyslawKlys we gave this a second look and you are correct...thanks for also grabbing the code, I am going to mark this as "Up for Grabs" but if you are interested in making the fix we can help you get set up

rjmholt commented 4 years ago

Do you think providing new lines (for URL usage) is part of your responsibility or vscode to make sure it's properly encoded?

I'm just looking into this quickly and we immediately pass the body string to encodeURIComponent(). I would have expected that to do what we want. Certainly the way I'd want to implement this would be to put the body we want into a string in normal text and then use a library function to URI-escape it.

PrzemyslawKlys commented 4 years ago

Should it be closed? Its not fixed is it?

rjmholt commented 4 years ago

I think the bot closed this because it's labelled Resolution-External

TylerLeonhardt commented 4 years ago

It's a valid issue... it's just low pri since open works.

andyleejordan commented 2 years ago

Ditto @PrzemyslawKlys

PrzemyslawKlys commented 2 years ago

@andschwa It's no longer valid. Since you implemented the requirement to choose Issue/new features when you create a new one in this report the function in VSCode to upload bug reports is a bit useless :-)

andyleejordan commented 2 years ago

Yay!