emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/calibre 9e532313c9 5/8: Handle invalid timestamps


From: ELPA Syncer
Subject: [elpa] externals/calibre 9e532313c9 5/8: Handle invalid timestamps
Date: Tue, 12 Dec 2023 06:57:35 -0500 (EST)

branch: externals/calibre
commit 9e532313c97c02ed7b2c8ac2bdf5e330a151f101
Author: Kjartan Oli Agustsson <kjartanoli@disroot.org>
Commit: Kjartan Oli Agustsson <kjartanoli@disroot.org>

    Handle invalid timestamps
    
    * calibre-db.el (calibre-db--parse-timestamp): Return nil instead of
      signalling an error when calling parse-iso8601-time-string with an
      invalid string.
    
    * calibre-core.el (calibre-book--print-info): Check that pubdate is
      non-nil before attempting to format it.
    
    * etc/NEWS: Mention the fixing of this bug.
    
    Some time strings which parse successfully (although potentially to
    nonsensical time stamps) on GNU/Linux signal an error on Windows,
    making it impossible to open the *Library* buffer if a library
    contains a book with such a time string.
---
 calibre-core.el | 4 +++-
 calibre-db.el   | 2 +-
 etc/NEWS        | 5 +++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/calibre-core.el b/calibre-core.el
index 329cfd7c06..915f1702e1 100644
--- a/calibre-core.el
+++ b/calibre-core.el
@@ -189,7 +189,9 @@ BOOK is a `calibre-book'."
                                (series-index (if (calibre-book-series book) 
(format "%.1f" (calibre-book-series-index book)) ""))
                                (tags (string-join (calibre-book-tags book) ", 
"))
                                (formats (string-join (mapcar (lambda (f) 
(upcase (symbol-name f))) (calibre-book-formats book)) ", "))
-                               (pubdate (format-time-string 
calibre-library-time-format (calibre-book-pubdate book))))))
+                               (pubdate (if (calibre-book-pubdate book)
+                                            (format-time-string 
calibre-library-time-format (calibre-book-pubdate book))
+                                          "Invalid")))))
                          calibre-library-columns))))
 
 (defun calibre-book--file (book format)
diff --git a/calibre-db.el b/calibre-db.el
index 6c1e732f8b..20ffc031f8 100644
--- a/calibre-db.el
+++ b/calibre-db.el
@@ -34,7 +34,7 @@
 (defun calibre-db--parse-timestamp (timestamp)
   "Return a Lisp timestamp from TIMESTAMP.
 TIMESTAMP is a string of the form YYYY-MM-DD HH:MM:SS.xxxxxx+00:00."
-  (parse-iso8601-time-string (string-replace " " "T" timestamp)))
+  (ignore-errors (parse-iso8601-time-string (string-replace " " "T" 
timestamp))))
 
 (defun calibre-db--make-book (entry)
   "Create a `calibre-book' from ENTRY.
diff --git a/etc/NEWS b/etc/NEWS
index 9f02aaadd0..22e1bc3ac4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -7,6 +7,11 @@ This file is about changes in calibre.el, the Emacs client for
 Calibre.
 
 
+* Changes in calibre.el 1.3.4
+** Fix a timestamp parsing bug on Windows
+Some timestamps signalled errors when parsed on Windows.
+
+
 * Changes in calibre.el 1.3.3
 
 ** Fix series widget in metadata editing



reply via email to

[Prev in Thread] Current Thread [Next in Thread]