oll3 / bita

Differential file synchronization over http
https://crates.io/crates/bita
MIT License
265 stars 10 forks source link

Bug: Fix local paths incorrectly parsed as urls on windows in bita #19

Closed rminderhoud closed 2 years ago

rminderhoud commented 2 years ago

Previously in bita, when a user provided an input path an attempt was made to parse it as a URL. If this failed it would fallback to being used as a local path. However, windows paths are succesfully parsed as a url (e.g. C:\temp\my_archive.cba) which caused a bug on windows where inputs were always treated as a remote path.

This fix inverts the behavior and first checks if the path is a valid local path before checking if it's a valid remote path.

Closes: #18

oll3 commented 2 years ago

Since I do not typically run bita on windows I haven't encountered this behavior. But looks like a good fix to me!

Would've been nice to ensure that this behavior is kept over time with some tests. But since there are no tests in place for the cli parameter parsing (or integration tests for bita) at this time I think this is fine.

Thanks! :star: