CLOUDFLARE: Bugfix for Redirect, correct typo in error message. (#3033)

This commit is contained in:
Josh Zhang 2024-07-02 16:25:30 -04:00 committed by GitHub
parent 5ef1e9979b
commit a091da9067
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -149,7 +149,7 @@ func makeRuleFromPattern(pattern, replacement string, temporary bool) (string, s
expr = fmt.Sprintf(`concat("https://%s", http.request.uri.path)`, rhost)
} else if strings.Count(host, `*`) == 1 && strings.Count(path, `*`) == 1 &&
strings.Count(replacement, `$`) == 1 && rpath == `/$2` {
strings.Count(replacement, `$`) == 1 && strings.HasPrefix(rpath, `/$2`) {
// https://careers.stackoverflow.com/$2
expr = fmt.Sprintf(`concat("https://%s", http.request.uri.path)`, rhost)
@ -165,7 +165,7 @@ func makeRuleFromPattern(pattern, replacement string, temporary bool) (string, s
return "", "", fmt.Errorf("conversion not implemented for pattern: %s", origPattern)
}
if expr == "" {
return "", "", fmt.Errorf("conversion not implemented for replacemennt: %s", origReplacement)
return "", "", fmt.Errorf("conversion not implemented for replacement: %s", origReplacement)
}
return matcher, expr, nil