psanford / wormhole-william

End-to-end encrypted file transfer. A magic wormhole CLI and API in Go (golang).
MIT License
1.08k stars 55 forks source link

cmd: Fix dir send on Windows when the given path use / over \ #30

Closed Jacalz closed 3 years ago

Jacalz commented 3 years ago

I was noticing, in wormhole-gui, that sending directories on Windows always failed with an error. After some debugging, it turns out that filepath.Walk calls the path with "\", but if the given path contains forward slashes, calling filepath.TrimPrefix will fail. You might say that this PR makes it possible to use “/“ when used on Windows and is thus perhaps more of a feature than a bug fix. If you don’t want to add this, I won’t complain.

It also features a minor cleanup inside the filepath.Walk function. I figured that I would open a PR upstream as the same issue can be found in the command line utility. Merry Christmas :christmas_tree:

Jacalz commented 3 years ago

This is honestly a bad solution to something that is almost a non issue. A Linux user like me can just press tab and have powershell auto complete the correct backslash path.