modules: Fix potential infinite loop in module collection - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit f40f50ead0c46db984e9b970e0361e85c396c200
DIR parent 4e483f5d4abae136c4312d397a55e9e1d39148df
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Mon, 22 Apr 2024 10:39:36 +0200
modules: Fix potential infinite loop in module collection
Fixes #12407
Diffstat:
M modules/collect.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
DIR diff --git a/modules/collect.go b/modules/collect.go
@@ -261,7 +261,10 @@ func (c *collector) add(owner *moduleAdapter, moduleImport Import) (*moduleAdapt
// This will select the latest release-version (not beta etc.).
versionQuery = "upgrade"
}
- if err := c.Get(fmt.Sprintf("%s@%s", modulePath, versionQuery)); err != nil {
+
+ // Note that we cannot use c.Get for this, as that may
+ // trigger a new module collection and potentially create a infinite loop.
+ if err := c.get(fmt.Sprintf("%s@%s", modulePath, versionQuery)); err != nil {
return nil, err
}
if err := c.loadModules(); err != nil {