anatol / pacoloco

Caching proxy server for Arch Linux pacman
MIT License
199 stars 30 forks source link

fix double slash in upstreamURL #85

Closed TheFox0x7 closed 1 year ago

TheFox0x7 commented 1 year ago

pathRegex segments the url into 3 sections, the pathAtRepo being for example /extra/os/x86_64, package never has a / in front. urlPath would return a string without / in front if pathAtRepo was an empty string, the adding / in front was required. But if pathAtRepo had a value the added / would result in //extra/os/x86_64 as a prefix.

This PR corrects that behavior so it always returns a string starting with /.

anatol commented 1 year ago

The change looks good.

Can we also have a check for it in the tests to make sure we'll not have this problem in the future?