Fix #+LINK: file xyz edge case

if we define a custom LINK for file we run into index problems bc it's trimmed
before already - this fixes that. Shouldn't ever happen but whatever, fuzzing
found it.
This commit is contained in:
Niklas Fasching 2020-04-17 16:17:30 +02:00
parent 1e36b3b46b
commit 2ab65d300a

View file

@ -339,7 +339,7 @@ func (w *HTMLWriter) WriteRegularLink(l RegularLink) {
url = url[len("file:"):] url = url[len("file:"):]
} }
if prefix := w.document.Links[l.Protocol]; prefix != "" { if prefix := w.document.Links[l.Protocol]; prefix != "" {
url = html.EscapeString(prefix) + url[len(l.Protocol)+1:] url = html.EscapeString(prefix) + strings.TrimPrefix(url, l.Protocol+":")
} }
description := url description := url
if l.Description != nil { if l.Description != nil {