mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 03:59:03 +08:00
Fix: bad escape \P at position 374 (line 18, column 23) when using th… (#7909)
…e graph feature (#1727) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
243ed4bc35
commit
1239f5afc8
@ -119,7 +119,10 @@ class Template(ComponentBase):
|
||||
v = json.dumps(v, ensure_ascii=False)
|
||||
except Exception:
|
||||
pass
|
||||
content = re.sub(r"\{%s\}" % re.escape(n), v, content)
|
||||
# Process backslashes in strings, Use Lambda function to avoid escape issues
|
||||
if isinstance(v, str):
|
||||
v = v.replace("\\", "\\\\")
|
||||
content = re.sub(r"\{%s\}" % re.escape(n), lambda match: v, content)
|
||||
content = re.sub(r"(#+)", r" \1 ", content)
|
||||
|
||||
return Template.be_output(content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user