mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #26116 from corux/fix-escape-content
file.replace fails if repl string is an invalid regex and append/prepend is used
This commit is contained in:
commit
abdf2935c4
1 changed files with 1 additions and 1 deletions
|
@ -1145,7 +1145,7 @@ def replace(path,
|
|||
if prepend_if_not_found or append_if_not_found:
|
||||
# Search for content, so we don't continue pre/appending
|
||||
# the content if it's been pre/appended in a previous run.
|
||||
if re.search('^{0}$'.format(content), line):
|
||||
if re.search('^{0}$'.format(re.escape(content)), line):
|
||||
# Content was found, so set found.
|
||||
found = True
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue