aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-04-22 10:39:36 +0200
committerBjørn Erik Pedersen <[email protected]>2024-04-22 11:34:11 +0200
commitf40f50ead0c46db984e9b970e0361e85c396c200 (patch)
tree32744b8e6711dfcee6c16559a0ef0ba76f103f78
parent4e483f5d4abae136c4312d397a55e9e1d39148df (diff)
downloadhugo-f40f50ead0c46db984e9b970e0361e85c396c200.tar.gz
hugo-f40f50ead0c46db984e9b970e0361e85c396c200.zip
modules: Fix potential infinite loop in module collection
Fixes #12407
-rw-r--r--modules/collect.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/collect.go b/modules/collect.go
index e7d5dbe29..dff71924b 100644
--- 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 {