diff options
author | gzagatti <gzagatti@users.noreply.github.com> | 2021-01-11 16:46:31 +0800 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-02-22 13:52:04 +0100 |
commit | 01dd7c16af6204d18d530f9d3018689215482170 (patch) | |
tree | 4020b7fc7f4d6e96b942d4800c00b82cad178ae9 /markup/asciidocext/convert.go | |
parent | c8f45d1d861f596821afc068bd12eb1213aba5ce (diff) |
Fixes #7698.
markup: Allow installed arbitrary Asciidoc extension via path validation.
Diffstat (limited to 'markup/asciidocext/convert.go')
-rw-r--r-- | markup/asciidocext/convert.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/markup/asciidocext/convert.go b/markup/asciidocext/convert.go index 51f114be2..10e16810e 100644 --- a/markup/asciidocext/convert.go +++ b/markup/asciidocext/convert.go @@ -19,6 +19,7 @@ package asciidocext import ( "bytes" "path/filepath" + "strings" "github.com/gohugoio/hugo/htesting" @@ -105,11 +106,10 @@ func (a *asciidocConverter) parseArgs(ctx converter.DocumentContext) []string { args = a.appendArg(args, "-b", cfg.Backend, asciidocext_config.CliDefault.Backend, asciidocext_config.AllowedBackend) for _, extension := range cfg.Extensions { - if !asciidocext_config.AllowedExtensions[extension] { - a.cfg.Logger.Errorln("Unsupported asciidoctor extension was passed in. Extension `" + extension + "` ignored.") + if strings.LastIndexAny(extension, `\/.`) > -1 { + a.cfg.Logger.Errorln("Unsupported asciidoctor extension was passed in. Extension `" + extension + "` ignored. Only installed asciidoctor extensions are allowed.") continue } - args = append(args, "-r", extension) } |