Fix Default cdn behavior (#9)

- CDN returned as-is for processing if no template indicators are found

-Skip G.
This commit is contained in:
skip77 2023-02-27 15:26:21 -05:00 committed by GitHub
parent 2c6d6f0b0a
commit 5e8ed2e521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -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 {