diff options
| author | eltrac <hi@eltr.ac> | 2026-09-23 18:17:48 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-09-23 18:17:48 +0800 |
| commit | 10715340fb8cab4d1024a3e83a218e06a7a2f295 (patch) | |
| tree | ff49cc9eee7c99e5b08dd3ff15854a5e38f4f496 /src | |
| parent | dbf0ff643bee01b4327a4f835d2d3bb656d72bba (diff) | |
http.downloader: report file size on disk, not via http header Content-Length
Diffstat (limited to 'src')
| -rw-r--r-- | src/weepinbell/http/downloader.clj | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/weepinbell/http/downloader.clj b/src/weepinbell/http/downloader.clj index d1a6df1..5acfcc2 100644 --- a/src/weepinbell/http/downloader.clj +++ b/src/weepinbell/http/downloader.clj @@ -11,16 +11,13 @@ parent-dir (.getParentFile file)] (when (and parent-dir (not (.exists parent-dir))) (.mkdirs parent-dir)) - (let [response (client/get! url {:as :stream}) - content-length (get-in response [:headers "content-length"])] + (let [response (client/get! url {:as :stream})] (timbre/info "Downloading [" url "] -> [" dest-path "]") - (when content-length - (timbre/info "File size:" content-length "bytes")) ;; write to output stream (with-open [in (:body response) out (io/output-stream file)] (io/copy in out)) - (timbre/info "Download success.") + (timbre/info "Download success. File size:" (.length file) "bytes") true)) ;; when download failed (catch Exception e |
