feat: add multi-engine regex flavour support
This commit is contained in:
@@ -5,6 +5,7 @@ Pyodide runtime starts. User-controlled values are passed as function
|
||||
arguments; they are never evaluated as Python source.
|
||||
"""
|
||||
|
||||
import base64
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
@@ -256,9 +257,16 @@ def _regex_tools_run(
|
||||
"resultsTruncated": results_truncated,
|
||||
}
|
||||
if operation == "replace":
|
||||
output = "".join(output_chunks).encode("utf-8")
|
||||
if len(output) != output_bytes:
|
||||
return _error(
|
||||
"bridge",
|
||||
"output-byte-count-mismatch",
|
||||
"The bounded Python output byte count is inconsistent.",
|
||||
)
|
||||
result.update(
|
||||
{
|
||||
"output": "".join(output_chunks),
|
||||
"outputBase64": base64.b64encode(output).decode("ascii"),
|
||||
"outputBytes": output_bytes,
|
||||
"outputTruncated": output_truncated,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user