From 5e8ed2e5211229822730b45c608276b1349f75ff Mon Sep 17 00:00:00 2001 From: skip77 <75801365+skip77@users.noreply.github.com> Date: Mon, 27 Feb 2023 15:26:21 -0500 Subject: [PATCH] Fix Default cdn behavior (#9) - CDN returned as-is for processing if no template indicators are found -Skip G. --- pkg/modes/git.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/modes/git.go b/pkg/modes/git.go index 855afdc..4843b12 100644 --- a/pkg/modes/git.go +++ b/pkg/modes/git.go @@ -498,6 +498,11 @@ func (g *GitMode) ImportName(pd *data.ProcessData, md *data.ModeData) string { func ProcessUrl(cdnUrl string, name string, branch string, hash string, hashtype string, filename string) (string, bool) { tmpUrl := Lookaside{name, branch, hash, hashtype, filename} + // Return cdnUrl as-is if we don't have any templates ("{{ .Variable }}") to process: + if !(strings.Contains(cdnUrl, "{{") && strings.Contains(cdnUrl, "}}")) { + return cdnUrl, false + } + // If we run into trouble with our template parsing, we'll just return the cdnUrl, exactly as we found it tmpl, err := template.New("").Parse(cdnUrl) if err != nil {