Add module.replacements

Fixes #7904
Fixes #7908
This commit is contained in:
Bjørn Erik Pedersen
2020-10-29 17:14:04 +01:00
parent 8a1c637c44
commit 173187e263
5 changed files with 146 additions and 25 deletions

View File

@@ -613,6 +613,15 @@ func (c *Client) shouldVendor(path string) bool {
return c.noVendor == nil || !c.noVendor.Match(path)
}
func (c *Client) createThemeDirname(modulePath string, isProjectMod bool) (string, error) {
modulePath = filepath.Clean(modulePath)
moduleDir := filepath.Join(c.ccfg.ThemesDir, modulePath)
if !isProjectMod && !strings.HasPrefix(moduleDir, c.ccfg.ThemesDir) {
return "", errors.Errorf("invalid module path %q; must be relative to themesDir when defined outside of the project", modulePath)
}
return moduleDir, nil
}
// ClientConfig configures the module Client.
type ClientConfig struct {
Fs afero.Fs