summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-02-27 21:38:57 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-02-27 21:38:57 +0100
commitb59ef4b75504f697d560728007946c3aa95bc3dd (patch)
treea3f7207e8a2a56792fe0e91fe6ed4ae10de4f6d5
parentb29b962eecbbadecda4ad63e1c9a6d33710bcc05 (diff)
Book Marx: Support an additional “title” URI parameter.
-rw-r--r--src/mulk/benki/book_marx.clj27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/mulk/benki/book_marx.clj b/src/mulk/benki/book_marx.clj
index 1ac7b8d..e1f0850 100644
--- a/src/mulk/benki/book_marx.clj
+++ b/src/mulk/benki/book_marx.clj
@@ -94,19 +94,22 @@
(catch java.lang.Exception e#
nil)))
-(defpage [:get "/marx/submit"] {uri :uri, description :description, origin :origin}
+(defpage [:get "/marx/submit"] {uri :uri, description :description, origin :origin, title :title}
(with-auth
- (let [title (m/domonad m/maybe-m
- ;; FIXME: Using slurp here is a potential security problem
- ;; because it permits access to internal resources!
- [:when uri
- :when (or (.startsWith uri "http://")
- (.startsWith uri "https://"))
- soup (ignore-errors (slurp uri))
- page (org.jsoup.Jsoup/parse soup)
- title (.select page "title")]
- (.text title))
- origin (or origin (get-in (request/ring-request) [:headers "Referer"]))]
+ (let [title (or title
+ (m/domonad m/maybe-m
+ ;; FIXME: Using slurp here is a potential security problem
+ ;; because it permits access to internal resources!
+ [:when uri
+ :when (or (.startsWith uri "http://")
+ (.startsWith uri "https://"))
+ soup (ignore-errors (slurp uri))
+ page (org.jsoup.Jsoup/parse soup)
+ title (.select page "title")]
+ (.text title)))
+ origin (or origin
+ (get-in (request/ring-request) [:headers "Referer"])
+ uri)]
(layout bookmarx-submission-page "Submit New Bookmark"
[:form {:method "POST"}
[:table