weavejester/compojure — Issue #47: Exception when %5C is used in a url with route/resource
Author: ibdknox
Created: 2012-01-06 01:28:28+00:00
State: open

Hey James,

Running this code:

```clojure
(use 'compojure.core 'compojure.route)
(defroutes x (GET "/" [] "blah") (resources "/"))
(x {:uri "/%5C" :request-method :get})
```
I get the following exception:

```
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
nil
at java.lang.String.charAt(String.java:686)
at java.util.regex.Matcher.appendReplacement(Matcher.java:703)
at clojure.string$replace_by.invoke(string.clj:58)
at clojure.string$replace.invoke(string.clj:82)
at clout.core$path_decode.invoke(core.clj:33)
at clout.core$path_decode.invoke(core.clj:31)
at clojure.core$map$fn__3811.invoke(core.clj:2430)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:466)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$map$fn__3815.invoke(core.clj:2435)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:466)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$reduce.invoke(core.clj:5994)
at clout.core$assoc_keys_with_groups.invoke(core.clj:56)
at clout.core.CompiledRoute.route_matches(core.clj:86)
at compojure.core$if_route$fn__437.invoke(core.clj:38)
at compojure.core$if_method$fn_user=> _430.invoke(core.clj:24)
at ring.middleware.file_info$wrap_file_info$fn__941.invoke(file_info.clj:40)
at ring.middleware.content_type$wrap_content_type$fn__921.invoke(content_type.clj:18)
at compojure.core$routing$fn__456.invoke(core.clj:98)
at clojure.core$some.invoke(core.clj:2388)
at compojure.core$routing.doInvoke(core.clj:98)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:602)
at compojure.core$routes$fn__460.invoke(core.clj:103)
at user$eval968.invoke(NO_SOURCE_FILE:15)
at clojure.lang.Compiler.eval(Compiler.java:6465)
at clojure.lang.Compiler.eval(Compiler.java:6431)
at clojure.core$eval.invoke(core.clj:2795)
at clojure.main$repl$read_eval_print__5967.invoke(main.clj:244)
at clojure.main$repl$fn__5972.invoke(main.clj:265)
at clojure.main$repl.doInvoke(main.clj:265)
at clojure.lang.RestFn.invoke(RestFn.java:512)
at user$eval27$acc__3869__auto____30$fn__32.invoke(NO_SOURCE_FILE:1)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:680)
```