waveterm icon indicating copy to clipboard operation
waveterm copied to clipboard

[Bug]: setbg is not working for images in Windows 10

Open SamimAB opened this issue 1 year ago • 0 comments

Current Behavior

Currently this is what happens when you to set an image as background using wsh setbg image.jpeg.

  1. In the GO backend, ExpandHomeDir method cleans it up and gets the full path as defined by the OS. In case of Windows 10, this method will return "D:\DOWNLOADS\image.jpeg".
  2. Then in frontend when it is being parsed using "css-tree", it is causing the bug because css-tree's parse method does not parse id correctly as it parses backslashes as escape characters.
  3. In DevTools you can see this message "Invalid background, contains an unsafe URL scheme: D:OWNLOADSimage.jpeg". As you see it is not being parsed correctly.

Possible Solution: As far as I know, CSS on Windows can parse paths with Linux-style forward slashes (/) because Windows supports both backslashes (\) and forward slashes for file paths.

Expected Behavior

It should set the the background to the image in the path.

Steps To Reproduce

  1. In Windows 10 open waveterm.
  2. try to change the background with a image - wsh setbg image.jpeg

Wave Version

0.10.4

Platform

Windows

OS Version/Distribution

Windows 10

Architecture

x64

Anything else?

No response

Questionnaire

  • [ ] I'm interested in fixing this myself but don't know where to start
  • [X] I would like to fix and I have a solution
  • [ ] I don't have time to fix this right now, but maybe later

SamimAB avatar Dec 22 '24 22:12 SamimAB