Fix for #1718 (fetch of metadata from google without cover leads to exception)

pull/1613/merge
Ozzieisaacs 4 years ago
parent 32b7b39223
commit 42c13ae135

@ -652,6 +652,9 @@ def edit_book(book_id):
if to_save["cover_url"]:
if not current_user.role_upload():
return "", (403)
if to_save["cover_url"].endswith('/static/generic_cover.jpg'):
book.has_cover = 0
else:
result, error = helper.save_cover_from_url(to_save["cover_url"], book.path)
if result is True:
book.has_cover = 1

@ -108,7 +108,7 @@ $(function () {
tags: result.volumeInfo.categories || [],
rating: result.volumeInfo.averageRating || 0,
cover: result.volumeInfo.imageLinks ?
result.volumeInfo.imageLinks.thumbnail : "/static/generic_cover.jpg",
result.volumeInfo.imageLinks.thumbnail : location + "/../../../static/generic_cover.jpg",
url: "https://books.google.com/books?id=" + result.id,
source: {
id: "google",

Loading…
Cancel
Save