1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-26 10:00:37 +00:00

Gracefully deal with incorrect dates

This commit is contained in:
Wulf Rajek 2022-04-12 00:22:05 +01:00
parent 2d0af0ab49
commit adf6728f14

View File

@ -983,9 +983,9 @@ def create_book_on_upload(modify_date, meta):
# combine path and normalize path from Windows systems # combine path and normalize path from Windows systems
path = os.path.join(author_dir, title_dir).replace('\\', '/') path = os.path.join(author_dir, title_dir).replace('\\', '/')
if meta.pubdate != "": try:
pubdate = datetime.strptime(meta.pubdate[:10], "%Y-%m-%d") pubdate = datetime.strptime(meta.pubdate[:10], "%Y-%m-%d")
else: except:
pubdate = datetime(101, 1, 1) pubdate = datetime(101, 1, 1)
# Calibre adds books with utc as timezone # Calibre adds books with utc as timezone