Use regexp.QuoteMeta to escape destination when having "+" in front of it

This commit is contained in:
TeoV
2020-02-06 10:54:28 +02:00
committed by Dan Christian Bogos
parent bb0803bd96
commit fbc30d600e

View File

@@ -1033,13 +1033,10 @@ func (ms *MongoStorage) GetCDRs(qryFltr *utils.CDRsFilter, remove bool) ([]*CDR,
if len(prefix) == 0 {
continue
}
if strings.HasPrefix(prefix, "+") {
prefix = "\\" + prefix
}
if len(regexpRule) != 0 {
regexpRule += "|"
}
regexpRule += "^(" + prefix + ")"
regexpRule += "^(" + regexp.QuoteMeta(prefix) + ")"
}
if _, hasIt := filters["$and"]; !hasIt {
filters["$and"] = make([]bson.M, 0)