Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Handle requests for old URLs from CIDER specially
Browse files Browse the repository at this point in the history
Fixes #150
  • Loading branch information
arrdem committed Dec 22, 2014
1 parent 44b4750 commit bf5e277
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/grimoire/web/routes.clj
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,12 @@
;; Redirect legacy paths into the store
(context ["/:version", :version #"[0-9]+.[0-9]+.[0-9]+"] [version]
(fn [request]
(warn "Redirecting!")
(response/redirect (str "/store/org.clojure/clojure"
(:uri request)))))
(let [user-agent (get-in request [:headers "user-agent"])
new-uri (str "/store/org.clojure/clojure"
(:uri request))]
(if (= user-agent "URL/Emacs")
(store (assoc request :uri new-uri)) ;; pass it forwards
(response/redirect new-uri))))) ;; everyone else

(route/not-found
(fn [{uri :uri :as req}]
Expand Down

0 comments on commit bf5e277

Please sign in to comment.