Skip to content

Commit

Permalink
Prevent empty links caused by link-directive
Browse files Browse the repository at this point in the history
This addresses the issue where a `{{link('/')}}` will get expanded
into an anchor tag with no inner content by forcing the leading `/`
in the expansion.

Fixes #35
  • Loading branch information
John E. Rollinson committed Dec 1, 2021
1 parent 3f4765c commit f646e12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmgr/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (m *Manager) validateMetadata(md *ChallengeMetadata) error {
r = `<a href='{{url("${1}")}}' download>${2}</a>`
s = urlForRe.ReplaceAllString(s, r)

r = `<a href='{{http_base("${1}")}}:{{port("${1}")}}/${2}' target='_blank'>${2}</a>`
r = `<a href='{{http_base("${1}")}}:{{port("${1}")}}/${2}' target='_blank'>/${2}</a>`
s = linkRe.ReplaceAllString(s, r)

r = `<a href='{{http_base("${1}")}}:{{port("${1}")}}/${2}' target='_blank'>${3}</a>`
Expand Down

0 comments on commit f646e12

Please sign in to comment.