Skip to content

Commit

Permalink
Handle // scheme prefix (#75)
Browse files Browse the repository at this point in the history
* Handle /// scheme prefix

* Update to two /'s

* chore: minor formatting fix

* Update hugo_gen_setup.go

---------

Co-authored-by: Ashish Bhatia <[email protected]>
  • Loading branch information
acrosman and ashishb authored Oct 29, 2024
1 parent c4d47a3 commit cb78882
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/wp2hugo/internal/hugogenerator/hugo_gen_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ func (g Generator) downloadPageMedia(outputMediaDirPath string, p *hugopage.Page
prefixes = append(prefixes, fmt.Sprintf("http://www.%s", hostname))

for _, link := range links {
if strings.HasPrefix(link, "//") {
link = strings.Replace(link, "//", fmt.Sprintf("%s://", pageURL.Scheme), 1)
}
for _, prefix := range prefixes {
link = strings.TrimPrefix(link, prefix)
}
Expand Down

0 comments on commit cb78882

Please sign in to comment.