diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/weepinbell/microformats/wrapper.clj | 6 | ||||
| -rw-r--r-- | src/weepinbell/receiver.clj | 3 | ||||
| -rw-r--r-- | src/weepinbell/utils.clj | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/weepinbell/microformats/wrapper.clj b/src/weepinbell/microformats/wrapper.clj index 42975e0..fdf8bbd 100644 --- a/src/weepinbell/microformats/wrapper.clj +++ b/src/weepinbell/microformats/wrapper.clj @@ -53,7 +53,6 @@ (defn- get-card-info "Get essential information of an h-card item and flatten it into a map." [card] - {:post [(s/valid? ::mf-h-card %)]} (when (and card (= (get-mf-type card) "h-card")) (let [data {:name (get-prop-first card :name) @@ -61,13 +60,12 @@ :photo (get-prop-first card :photo) :url (get-prop-first card :url)}] (when-not (s/valid? ::mf-h-card data) - (timbre/warn "microformats h-card in bad form")) + (timbre/warn "microformats h-card in bad form:" data)) data))) (defn wrap-entry "Wrap parsed raw microformats (h-entry) data. If no h-entry found, return nil." [entry] - {:post [(s/valid? ::mf-h-entry %)]} ;; make sure it's h-entry (when (and entry (= (get-mf-type entry) "h-entry")) @@ -76,6 +74,6 @@ :published (get-prop-first entry :published) :content (javamap->map (get-prop-first entry :content))}] (when-not (s/valid? ::mf-h-entry data) - (timbre/warn "microformats h-entry in bad form")) + (timbre/warn "microformats h-entry in bad form:" data)) data))) diff --git a/src/weepinbell/receiver.clj b/src/weepinbell/receiver.clj index a0779dd..8a77aad 100644 --- a/src/weepinbell/receiver.clj +++ b/src/weepinbell/receiver.clj @@ -9,7 +9,8 @@ (defn- remove-anchor "Takes a URL string. Removes anchor (#...)" [url] - (string/replace url #"#.*" "")) + (when (string? url) + (string/replace url #"#.*" ""))) ;; end utilities ;; validation and verification diff --git a/src/weepinbell/utils.clj b/src/weepinbell/utils.clj index a2e0cd9..6b862ab 100644 --- a/src/weepinbell/utils.clj +++ b/src/weepinbell/utils.clj @@ -22,7 +22,7 @@ (when content-length (timbre/info "File size:" content-length "bytes")) ;; write to output stream - (with-open [in (:body @response) + (with-open [in (:body response) out (io/output-stream file)] (io/copy in out)) (timbre/info "Download success.") |
