diff --git a/README.md b/README.md index 2e1257b..0b173ac 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,5 @@ vfox add nodejs ## Mirror You can configure the mirror by `VFOX_NODEJS_MIRROR` environment variable. The default value -is `https://nodejs.org/dist/`. +is `https://nodejs.org/dist`. Trailing slashes are automatically handled, so both +`https://nodejs.org/dist` and `https://nodejs.org/dist/` will work correctly. diff --git a/lib/util.lua b/lib/util.lua index 0c09de2..c063c13 100644 --- a/lib/util.lua +++ b/lib/util.lua @@ -9,7 +9,8 @@ function UTIL.getBaseUrl() if mirror == "" or mirror == nil then return "https://nodejs.org/dist" end - return mirror + -- Strip trailing slash to avoid double slashes in URL paths + return mirror:gsub("/$", "") end function UTIL.compare_versions(v1o, v2o)