diff options
Diffstat (limited to 'modules/client.go')
-rw-r--r-- | modules/client.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/client.go b/modules/client.go index d07483d36..c6f43298d 100644 --- a/modules/client.go +++ b/modules/client.go @@ -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 |