waveterm
waveterm copied to clipboard
[Bug]: setbg is not working for images in Windows 10
Current Behavior
Currently this is what happens when you to set an image as background using wsh setbg image.jpeg.
- 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".
- 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.
- 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
- In Windows 10 open waveterm.
- 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