Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Changed encode-path to use URLEncoder and replace + with %20, fix for issue #21 in neocons #2

Merged
merged 2 commits into from

2 participants

@tutysara

Changed encode-path to use URLEncoder and replace + with %20, fix for issue #21 in neocons.
Change passed all test cases in neocons and urly.
Haven't removed the old implementation, can be removed if it doesn't affect other projects in clojurewerks that uses urly.

@michaelklishin

This approach doesn't seem to be correct. URLEncoder should not be used for URI path encoding.

@michaelklishin

Oh well, the current one uses URLEncoder, too. Ok, then we should merge this as a temporary band-aid.

@michaelklishin michaelklishin merged commit 992984b into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 16, 2013
  1. @tutysara
Commits on Feb 17, 2013
  1. @tutysara

    changed encode-path to use URLEncoder and replace + with %20 for spac…

    tutysara authored
    …es - fix for issue #21 in neocons
This page is out of date. Refresh to see the latest.
View
7 src/clojure/clojurewerkz/urly/core.clj
@@ -411,7 +411,7 @@
;; Individual part encoding
;;
-(defn encode-path
+(defn _encode-path
"Escapes input as URI path"
[^String path]
(let [u (URI. nil
@@ -420,3 +420,8 @@
nil
nil)]
(.toASCIIString u)))
+
+(defn ^String encode-path
+ "Escapes input as URI path"
+ [^String s]
+ (.replace (URLEncoder/encode s) "+" "%20"))
View
3  test/clojurewerkz/urly/test/core_test.clj
@@ -805,4 +805,5 @@
(deftest test-path-escaping
(are [input output] (is (= (encode-path input) output))
"nodes" "nodes"
- "no des" "no%20des"))
+ "no des" "no%20des"
+ "no des with:" "no%20des%20with%3A"))
Something went wrong with that request. Please try again.