modules: Allow absolute paths for any modules resolved via project replacement

Fixes #8240
This commit is contained in:
Bjørn Erik Pedersen 2021-02-15 11:11:34 +01:00
parent 4ffaeaf155
commit 3a5ee0d2d6
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 9 additions and 7 deletions

View file

@ -276,7 +276,7 @@ func (c *collector) add(owner *moduleAdapter, moduleImport Import, disabled bool
// Fall back to project/themes/<mymodule>
if moduleDir == "" {
var err error
moduleDir, err = c.createThemeDirname(modulePath, owner.projectMod)
moduleDir, err = c.createThemeDirname(modulePath, owner.projectMod || moduleImport.pathProjectReplaced)
if err != nil {
c.err = err
return nil, nil

View file

@ -237,6 +237,7 @@ func decodeConfig(cfg config.Provider, pathReplacements map[string]string) (Conf
for i, imp := range c.Imports {
if newImp, found := c.replacementsMap[imp.Path]; found {
imp.Path = newImp
imp.pathProjectReplaced = true
c.Imports[i] = imp
}
}
@ -356,6 +357,7 @@ func (v HugoVersion) IsValid() bool {
type Import struct {
Path string // Module path
pathProjectReplaced bool // Set when Path is replaced in project config.
IgnoreConfig bool // Ignore any config in config.toml (will still folow imports).
IgnoreImports bool // Do not follow any configured imports.
NoVendor bool // Never vendor this import (only allowed in main project).