Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Sanitize Cypher query

  • Loading branch information...
commit 2d03ca21e4c2544dd895eb19e790355e1d9c0e4f 1 parent d95f8b4
Micah Cooper and Rogelio J. Samour authored Hashrocket Workstation committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/neography/rest.rb
View
6 lib/neography/rest.rb
@@ -342,7 +342,7 @@ def get_paths(from, to, relationships, depth=1, algorithm="allPaths")
end
def execute_query(query, params = {})
- options = { :body => {:query => query, :params => params}.to_json, :headers => {'Content-Type' => 'application/json'} }
+ options = { :body => {:query => sanitize(query), :params => params}.to_json, :headers => {'Content-Type' => 'application/json'} }
result = post("/cypher", options)
end
@@ -363,6 +363,10 @@ def batch(*args)
private
+ def sanitize(query)
+ query.strip.gsub(/\s+/, ' ')
+ end
+
def get_batch(args)
case args[0]
when :get_node
Please sign in to comment.
Something went wrong with that request. Please try again.