summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-06-19 09:01:00 +0000
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-06-19 09:02:15 +0000
commitb66de5eb3dc7d712413044a178b619f326f3aa8a (patch)
treec0db2c42eb6edb3a04caa2bd8f4aba2e2c486720
parent93f3cd287e8d7ab72d14b2cfb21100ad3d07b14d (diff)
Profile: Do not freak out when clients send requests without an Accept header.
-rw-r--r--src/mulk/benki/id.clj11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mulk/benki/id.clj b/src/mulk/benki/id.clj
index 4265945..56a86ee 100644
--- a/src/mulk/benki/id.clj
+++ b/src/mulk/benki/id.clj
@@ -137,13 +137,16 @@
(process-openid-request))
(defn render-profile-page [nickname]
- (if (re-find #"application/xrds\+xml"
- (get-in (request/ring-request) [:headers "accept"]))
- (render-xrds nickname)
- (show-profile-page (nickname-user nickname))))
+ (let [accept (get-in (request/ring-request) [:headers "accept"])]
+ (if (and accept
+ (re-find #"application/xrds\+xml"
+ (get-in (request/ring-request) [:headers "accept"])))
+ (render-xrds nickname)
+ (show-profile-page (nickname-user nickname)))))
(defpage [:get "/id/:nickname"] {nickname :nickname}
(render-profile-page nickname))
(defpage [:get "/~:nickname"] {nickname :nickname}
(render-profile-page nickname))
+