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.
This commit is contained in:
parent
4422899b7d
commit
9e532313c9
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
5
etc/NEWS
5
etc/NEWS
|
@ -6,6 +6,11 @@ See the end of the file for license conditions.
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue