Skip to content

Commit

Permalink
fix: remove querystring from the output file path
Browse files Browse the repository at this point in the history
Note that the file is still being downloaded from the correct source.
The output destination will have everything including and after '?'
removed.
  • Loading branch information
ashishb committed Oct 3, 2024
1 parent 3f3f51e commit dfb6052
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/wp2hugo/internal/hugogenerator/hugo_gen_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (g Generator) setupHugo(outputDirPath string) (*string, error) {
log.Error().
Err(err).
Bytes("output", output).
Str("cmd", combinedCommand).
Msg("error running Hugo setup commands")
return nil, fmt.Errorf("error running Hugo setup commands: %s", err)
}
Expand Down Expand Up @@ -425,7 +426,8 @@ func (g Generator) downloadPageMedia(outputMediaDirPath string, p *hugopage.Page
Str("source", pageURL.String()).
Msg("non-relative link")
}
outputFilePath := fmt.Sprintf("%s/static/%s", outputMediaDirPath, strings.TrimSuffix(link, "/"))
outputFilePath := fmt.Sprintf("%s/static/%s", outputMediaDirPath,
strings.TrimSuffix(strings.Split(link, "?")[0], "/"))
if !strings.HasPrefix(link, "http") {
link = g.wpInfo.Link + link
}
Expand Down

0 comments on commit dfb6052

Please sign in to comment.