Skip to content

Commit

Permalink
fix: don't download images sourced from other domains
Browse files Browse the repository at this point in the history
All media that's sourced from the domain other that the given domain (as
well as its www counterpart) will not be downloaded and will instead be
referenced externally as-is.
  • Loading branch information
ashishb committed Nov 18, 2024
1 parent b1da435 commit 64df053
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wp2hugo/internal/hugogenerator/hugo_gen_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ func (g Generator) downloadPageMedia(outputMediaDirPath string, p *hugopage.Page
log.Warn().
Str("link", link).
Str("source", pageURL.String()).
Msg("non-relative link")
Msg("non-relative link (skipped for download)")
continue
}
outputFilePath := fmt.Sprintf("%s/static/%s", outputMediaDirPath,
strings.TrimSuffix(strings.Split(link, "?")[0], "/"))
Expand Down

0 comments on commit 64df053

Please sign in to comment.