config: only regexp if at least two characters in replace search

This commit is contained in:
Mitchell Hashimoto 2015-03-02 09:46:46 -08:00
parent 5895494897
commit 63ee4c83ab
1 changed files with 1 additions and 1 deletions

View File

@ -97,7 +97,7 @@ func interpolationFuncReplace() ast.Function {
// We search/replace using a regexp if the string is surrounded
// in forward slashes.
if len(search) > 0 && search[0] == '/' && search[len(search)-1] == '/' {
if len(search) > 1 && search[0] == '/' && search[len(search)-1] == '/' {
re, err := regexp.Compile(search[1 : len(search)-1])
if err != nil {
return nil, err