Skip to content

Commit 0891bc0

Browse files
committed
Not the most elegant solution, may be other places that need fixing
1 parent d1e9cce commit 0891bc0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ function listVariables(dfg::CloudGraphsDFG, regexFilter::Union{Nothing, Regex}=n
397397
if regexFilter == nothing
398398
return _getLabelsFromCyphonQuery(dfg.neo4jInstance, "(node:$(join(_getLabelsForType(dfg, DFGVariable),':'))) where node.solvable >= $solvable $tagsFilter")
399399
else
400-
return _getLabelsFromCyphonQuery(dfg.neo4jInstance, "(node:$(join(_getLabelsForType(dfg, DFGVariable),':'))) where node.label =~ '$(regexFilter.pattern)' and node.solvable >= $solvable $tagsFilter")
400+
# Not happy about this but need to double escape the strings.
401+
return _getLabelsFromCyphonQuery(dfg.neo4jInstance, "(node:$(join(_getLabelsForType(dfg, DFGVariable),':'))) where node.label =~ '$(replace(regexFilter.pattern, "\\" => "\\\\"))' and node.solvable >= $solvable $tagsFilter")
401402
end
402403
end
403404

@@ -413,7 +414,7 @@ function listFactors(dfg::CloudGraphsDFG, regexFilter::Union{Nothing, Regex}=not
413414
if regexFilter == nothing
414415
return _getLabelsFromCyphonQuery(dfg.neo4jInstance, "(node:$(join(_getLabelsForType(dfg, DFGFactor),':'))) where node.solvable >= $solvable")
415416
else
416-
return _getLabelsFromCyphonQuery(dfg.neo4jInstance, "(node:$(join(_getLabelsForType(dfg, DFGFactor),':'))) where node.label =~ '$(regexFilter.pattern)' and node.solvable >= $solvable $tagsFilter")
417+
return _getLabelsFromCyphonQuery(dfg.neo4jInstance, "(node:$(join(_getLabelsForType(dfg, DFGFactor),':'))) where node.label =~ '$(replace(regexFilter.pattern, "\\" => "\\\\"))' and node.solvable >= $solvable $tagsFilter")
417418
end
418419
end
419420

0 commit comments

Comments
 (0)