clojurewerkz.neocons.rest.nodes/find-one throws URISyntaxException #21

Closed
tutysara opened this Issue Feb 16, 2013 · 5 comments

Comments

Projects
None yet
2 participants

clojurewerkz.neocons.rest.nodes/find-one throws URISyntaxException on finding %20(space) character (or any other character that should be encoded) in value when value contains ":"

Steps to recreate

(def record {:url "test" :name "test space:colon"})
(def node (nn/create record))
(def idx-test (nn/create-index "idx-test"))
(nn/add-to-index (:id node) (:name idx-test) "name" (:name record) true)
(nn/find-one (:name idx-test) "name" (:name record))

Probable fix

Modify core.clj in Urly and change encode-path to

(defn ^String encode-path
  [^String s]
  (.replace (URLEncoder/encode s) "+" "%20"))

passes all test cases in neocons with this change, will try to move this to urly and check if the functionality I am testing works, might submit a patch request tomorrow if everything is fine.

Changes are made in urly, passed all test cases in neocons and urly. Submitted a pull request in urly repo.

Owner

michaelklishin commented Feb 17, 2013

See comments to michaelklishin/urly#2. Also, I don't see any new test cases for Neocons.

michaelklishin pushed a commit that referenced this issue Feb 17, 2013

Owner

michaelklishin commented Feb 17, 2013

1.1.0-beta4 is out. Let me know if it works, then I'll write up an announcement. Thank you!

A long term solution would be to come up with a JVM (probably Java, since all JVM languages are plagued by the URI encoding situation) library that correctly encodes each path segment separately.

Thx a lot for the quick solution. Sorry about missing test cases for neocons. Tested with 1.1.0-beta4 and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment