Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
5186b326
Commit
5186b326
authored
Apr 15, 2023
by
pythongosssss
Browse files
Prevent generating bad replacement regex
parent
04d9bc13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
web/scripts/pnginfo.js
web/scripts/pnginfo.js
+1
-0
No files found.
web/scripts/pnginfo.js
View file @
5186b326
...
@@ -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
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment