Skip to content

Commit

Permalink
hugolib: Fix false WARNINGs in lang prefix check
Browse files Browse the repository at this point in the history
Add a slash to the check to make it less likely to match a valid value.

Fixes #5860
  • Loading branch information
bep committed Apr 15, 2019
1 parent 49d0a82 commit 7881b09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hugolib/page__meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (pm *pageMeta) setMetadata(p *pageState, frontmatter map[string]interface{}
return fmt.Errorf("URLs with protocol (http*) not supported: %q. In page %q", url, p.pathOrTitle())
}
lang := p.s.GetLanguagePrefix()
if lang != "" && !strings.HasPrefix(url, "/") && strings.HasPrefix(url, lang) {
if lang != "" && !strings.HasPrefix(url, "/") && strings.HasPrefix(url, lang+"/") {
if strings.HasPrefix(hugo.CurrentVersion.String(), "0.55") {
// We added support for page relative URLs in Hugo 0.55 and
// this may get its language path added twice.
Expand Down

0 comments on commit 7881b09

Please sign in to comment.