aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilij Schneidermann <mail@vasilij.de>2017-09-10 00:44:34 +0200
committerVasilij Schneidermann <mail@vasilij.de>2017-09-10 01:24:01 +0200
commit5f501ddb68dd234baf2e26e99df7d9e2defb25d3 (patch)
treeb198a62dbf60fc16ad7952738b9891d63df4ca9d
parent00099db9c6383929e678df21b52b1be571c012dc (diff)
Make unreadable files readable again
-rw-r--r--nov.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/nov.el b/nov.el
index 0e403c1..6f325be 100644
--- a/nov.el
+++ b/nov.el
@@ -146,6 +146,10 @@ Unnecessary nesting is removed with `nov-unnest-directory'."
(defun nov-slurp (filename)
"Return the contents of FILENAME."
+ ;; HACK: unzip preserves file permissions, no matter how silly they
+ ;; are, so ensure files are readable
+ (when (not (file-readable-p filename))
+ (set-file-modes filename #o444))
(with-temp-buffer
(insert-file-contents filename)
(buffer-string)))