telesoho / vscode-markdown-paste-image

Smartly paste for Markdown.
MIT License
136 stars 41 forks source link

pasting does not work in WSL #83

Closed rohitjagan closed 2 years ago

rohitjagan commented 2 years ago

When pasting something in WSL, I get the following error:

[04-03 10:17:32] //wsl.localhost/Ubuntu/home/rohitj/.vscode-server/extensions/telesoho.vscode-markdown-paste-image-0.18.6/res/scripts/win32_get_clipboard_content_type.ps1

[04-03 10:17:33] AuthorizationManager check failed.
    + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException

[04-03 10:17:33]     + FullyQualifiedErrorId : UnauthorizedAccess

[04-03 10:17:33] Clipboard Type:
[04-03 10:17:33] -1
[04-03 10:17:42] C:/path/to/paste/image

[04-03 10:17:42] //wsl.localhost/Ubuntu/home/rohitj/.vscode-server/extensions/telesoho.vscode-markdown-paste-image-0.18.6/res/scripts/win32_save_clipboard_png.ps1

[04-03 10:17:43] AuthorizationManager check failed.
    + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess

I was able to fix it by changing

https://github.com/telesoho/vscode-markdown-paste-image/blob/d3a30fdbb167083356e00b4e37b44528dc239548/src/paster.ts#L815

to

"bypass",

I think this is because using the unrestricted execution policy issues a warning when running the script and using bypass does not.