branch: elpa/hyperdrive
commit 1d719631f0ba53fc1a39c7f5ca6fff450f422076
Author: Joseph Turner <jos...@ushin.org>
Commit: Joseph Turner <jos...@ushin.org>

    Fix: (he//fill) Don't set nil values
    
    The POST request to clear the cache has neither Content-Length nor
    Last-Modified headers, and so we should not overwrite an entry's
    existing size or mtime slots if the current response headers are nil.
---
 hyperdrive-lib.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index b12b800785..1794821e49 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -728,11 +728,13 @@ Returns filled ENTRY."
         headers))
     (when last-modified
       (setf last-modified (encode-time (parse-time-string last-modified))))
-    (setf (he/size entry) (and content-length
-                               (ignore-errors
-                                 (cl-parse-integer content-length))))
-    (setf (he/type entry) content-type)
-    (setf (he/mtime entry) last-modified)
+    (when content-length
+      (setf (he/size entry)
+            (ignore-errors (cl-parse-integer content-length))))
+    (when content-type
+      (setf (he/type entry) content-type))
+    (when last-modified
+      (setf (he/mtime entry) last-modified))
     (when (and etag (not (h//entry-directory-p entry)))
       ;; Directory version ranges are not supported.
       (h/update-existent-version-range entry (string-to-number etag)))

Reply via email to