"web/git@developer.sourcefind.cn:chenpangpang/ComfyUI.git" did not exist on "e7b9d2c02cffd59fecca4ee617137ea38641078a"
Commit 5186b326 authored by pythongosssss's avatar pythongosssss
Browse files

Prevent generating bad replacement regex

parent 04d9bc13
...@@ -131,6 +131,7 @@ export async function importA1111(graph, parameters) { ...@@ -131,6 +131,7 @@ export async function importA1111(graph, parameters) {
} }
function replaceEmbeddings(text) { function replaceEmbeddings(text) {
if(!embeddings.length) return text;
return text.replaceAll( return text.replaceAll(
new RegExp( new RegExp(
"\\b(" + embeddings.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("\\b|\\b") + ")\\b", "\\b(" + embeddings.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("\\b|\\b") + ")\\b",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment