Skip to content

Commit ebb2be6

Browse files
Copilotbytemain
andauthored
Fix trailing slash in VFOX_NODEJS_MIRROR causing double slashes in URL paths (#25)
* Initial plan * Fix trailing slash issue in VFOX_NODEJS_MIRROR URL handling Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com>
1 parent 4afc116 commit ebb2be6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ vfox add nodejs
1313
## Mirror
1414

1515
You can configure the mirror by `VFOX_NODEJS_MIRROR` environment variable. The default value
16-
is `https://nodejs.org/dist/`.
16+
is `https://nodejs.org/dist`. Trailing slashes are automatically handled, so both
17+
`https://nodejs.org/dist` and `https://nodejs.org/dist/` will work correctly.

lib/util.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ function UTIL.getBaseUrl()
99
if mirror == "" or mirror == nil then
1010
return "https://nodejs.org/dist"
1111
end
12-
return mirror
12+
-- Strip trailing slash to avoid double slashes in URL paths
13+
return mirror:gsub("/$", "")
1314
end
1415

1516
function UTIL.compare_versions(v1o, v2o)

0 commit comments

Comments
 (0)