summaryrefslogtreecommitdiffstats
path: root/modules/client.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-29 17:14:04 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-30 09:41:05 +0100
commit173187e2633f3fc037c83e1e3de2902ae3c93b92 (patch)
tree92fbe7d0cd7dddf2eb229b074f24120c15d0407a /modules/client.go
parent8a1c637c4494751046142e0ef345fce38fc1431b (diff)
Add module.replacements
Fixes #7904 Fixes #7908
Diffstat (limited to 'modules/client.go')
-rw-r--r--modules/client.go9
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