aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup/external/external.go
diff options
context:
space:
mode:
authorNicolas Lenz <nicolas@eisfunke.com>2018-10-30 15:34:12 +0100
committertechknowlogick <hello@techknowlogick.com>2018-10-30 10:34:12 -0400
commit220ee6ae4296a9271a6d9b1825b00ed6f3d66659 (patch)
tree4159018c184c0ac05cb8760d5ba6656be3ab6e89 /modules/markup/external/external.go
parente61c6cd3dbc756b363f6e5441d67e207605c1dc0 (diff)
downloadgitea-220ee6ae4296a9271a6d9b1825b00ed6f3d66659.tar.gz
gitea-220ee6ae4296a9271a6d9b1825b00ed6f3d66659.zip
Pass link prefixes to external markup parsers (#5201)
* Pass environment variables for URL prefixes to external markup parser Signed-off-by: Nicolas Lenz <nicolas@eisfunke.com> * Document external markup link prefix environment variables Signed-off-by: Nicolas Lenz <nicolas@eisfunke.com> * Run format on link prefix changes Signed-off-by: Nicolas Lenz <nicolas@eisfunke.com>
Diffstat (limited to 'modules/markup/external/external.go')
-rw-r--r--modules/markup/external/external.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/markup/external/external.go b/modules/markup/external/external.go
index 676ec4b4c5..73bf7a327e 100644
--- a/modules/markup/external/external.go
+++ b/modules/markup/external/external.go
@@ -76,6 +76,11 @@ func (p *Parser) Render(rawBytes []byte, urlPrefix string, metas map[string]stri
}
cmd := exec.Command(commands[0], args...)
+ cmd.Env = append(
+ os.Environ(),
+ "GITEA_PREFIX_SRC="+urlPrefix,
+ "GITEA_PREFIX_RAW="+strings.Replace(urlPrefix, "/src/", "/raw/", 1),
+ )
if !p.IsInputFile {
cmd.Stdin = rd
}