juxt

jarohen 2017-07-31T10:21:01.275824Z

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?

jarohen 2017-07-31T10:25:09.355763Z

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 :(

jarohen 2017-07-31T10:25:41.366649Z

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

jarohen 2017-07-31T10:59:50.008162Z

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?

souenzzo 2017-07-31T13:53:55.166368Z

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

jarohen 2017-07-31T16:01:25.133238Z

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