Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ab4558

Browse files
committed
Potential fix for an Issue #846
1 parent ddfec1c commit 2ab4558

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/core/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,10 +1520,10 @@ def safeStringFormat(format_, params):
15201520

15211521
if format_.count(PAYLOAD_DELIMITER) == 2:
15221522
_ = format_.split(PAYLOAD_DELIMITER)
1523-
_[1] = _[1].replace("%d", "%s")
1523+
_[1] = re.sub(r"(\A|[^A-Za-z0-9])(%d)([^A-Za-z0-9]|\Z)", r"\g<1>%s\g<3>", _[1])
15241524
retVal = PAYLOAD_DELIMITER.join(_)
15251525
else:
1526-
retVal = format_.replace("%d", "%s")
1526+
retVal = re.sub(r"(\A|[^A-Za-z0-9])(%d)([^A-Za-z0-9]|\Z)", r"\g<1>%s\g<3>", format_)
15271527

15281528
if isinstance(params, basestring):
15291529
retVal = retVal.replace("%s", params, 1)

0 commit comments

Comments
 (0)