telesoho / vscode-markdown-paste-image

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

Newlines in path for WSL causing image saving failures #65

Closed pearj closed 2 years ago

pearj commented 2 years ago

I've been trying to use the WSL support for pasting of images from the clipboard and I have been getting errors like this:

[01-04 11:07:12] //wsl$/Ubuntu-20.04/home/joelp/dev/foam-template-master/journal/2022-01-04-11-07-10.png

[01-04 11:07:12] //wsl$/Ubuntu-20.04/home/joelp/.vscode-server/extensions/telesoho.vscode-markdown-paste-image-0.15.4/res/win32_save_clipboard_png.ps1

[01-04 11:07:13] Exception calling "Open" with "2" argument(s): "Illegal characters in path."
At \\wsl$\Ubuntu-20.04\home\joelp\.vscode-server\extensions\telesoho.vscode-markdown-paste-image-0.15.4\res\win32_save_
clipboard_png.ps1:25 char:1

I debugged my way through the extension and it looks like wslpath on my system is returning new lines after the filepath, which breaks powershell.

https://github.com/telesoho/vscode-markdown-paste-image/blob/5b093c386e4e4881be107ec255119f05d539773c/src/paster.ts#L39