Fork me on GitHub
#juxt
<
2017-07-31
>
jarohen10:07:01

morning JUXTers 🙂 think I've stumbled on a bug in bidi related to https://github.com/juxt/bidi/pull/128 - is here a good place to talk about it, or would you prefer github?

jarohen10:07:09

problem arises when a path param contains a colon, from what I can tell:

(bidi.bidi/match-route ["" {["/" :id] :handler}] "/foo") ; => {:route-params {:id "foo"}, :handler :handler}, as expected
(bidi.bidi/match-route ["" {["/" :id] :handler}] "/:foo") ; => nil :(

jarohen10:07:41

actually, I wonder whether that's even allowed? :thinking_face:

jarohen10:07:50

fix would mean adding : to the segment-regex-group for keywords, on which there's a comment: ;; This is a very common form, so we're conservative as a defence against injection attacks. would that be acceptable?

souenzzo13:07:55

(defn just-path
  [path]
  (apply str (take-while #(not= \? %) path))
=> #"^([^?]+)"

jarohen16:07:25

yep - although it doesn't match when it's part of a route-param variable, because that's got a different regex