diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/fetch.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index c7f2d549..90e7c79e 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
@@ -502,6 +502,14 @@ function fetch.fetch_sources(rockspec, extract, dest_dir) | |||
502 | assert(type(extract) == "boolean") | 502 | assert(type(extract) == "boolean") |
503 | assert(type(dest_dir) == "string" or not dest_dir) | 503 | assert(type(dest_dir) == "string" or not dest_dir) |
504 | 504 | ||
505 | -- auto-convert git://github.com URLs to use git+https | ||
506 | -- see https://github.blog/2021-09-01-improving-git-protocol-security-github/ | ||
507 | if rockspec.source.url:match("^git://github%.com/") | ||
508 | or rockspec.source.url:match("^git://www%.github%.com/") then | ||
509 | rockspec.source.url = rockspec.source.url:gsub("^git://", "git+https://") | ||
510 | rockspec.source.protocol = "git+https" | ||
511 | end | ||
512 | |||
505 | local protocol = rockspec.source.protocol | 513 | local protocol = rockspec.source.protocol |
506 | local ok, proto | 514 | local ok, proto |
507 | if dir.is_basic_protocol(protocol) then | 515 | if dir.is_basic_protocol(protocol) then |
@@ -522,6 +530,7 @@ function fetch.fetch_sources(rockspec, extract, dest_dir) | |||
522 | return nil, "Can't download "..rockspec.source.url.." -- only downloading from "..cfg.only_sources_from | 530 | return nil, "Can't download "..rockspec.source.url.." -- only downloading from "..cfg.only_sources_from |
523 | end | 531 | end |
524 | end | 532 | end |
533 | |||
525 | return proto.get_sources(rockspec, extract, dest_dir) | 534 | return proto.get_sources(rockspec, extract, dest_dir) |
526 | end | 535 | end |
527 | 536 | ||