From dfb6052fcb522f146a1403dc6a1418cc51043677 Mon Sep 17 00:00:00 2001 From: Ashish Bhatia Date: Thu, 3 Oct 2024 00:33:19 -0700 Subject: [PATCH] fix: remove querystring from the output file path Note that the file is still being downloaded from the correct source. The output destination will have everything including and after '?' removed. --- src/wp2hugo/internal/hugogenerator/hugo_gen_setup.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp2hugo/internal/hugogenerator/hugo_gen_setup.go b/src/wp2hugo/internal/hugogenerator/hugo_gen_setup.go index 886b4a9..9460509 100644 --- a/src/wp2hugo/internal/hugogenerator/hugo_gen_setup.go +++ b/src/wp2hugo/internal/hugogenerator/hugo_gen_setup.go @@ -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) } @@ -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 }