Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
42c13ae1
Commit
42c13ae1
authored
Nov 20, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #1718 (fetch of metadata from google without cover leads to exception)
parent
32b7b392
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
editbooks.py
cps/editbooks.py
+8
-5
get_meta.js
cps/static/js/get_meta.js
+1
-1
No files found.
cps/editbooks.py
View file @
42c13ae1
...
...
@@ -652,12 +652,15 @@ def edit_book(book_id):
if
to_save
[
"cover_url"
]:
if
not
current_user
.
role_upload
():
return
""
,
(
403
)
result
,
error
=
helper
.
save_cover_from_url
(
to_save
[
"cover_url"
],
book
.
path
)
if
result
is
True
:
book
.
has_cover
=
1
modif_date
=
True
if
to_save
[
"cover_url"
]
.
endswith
(
'/static/generic_cover.jpg'
):
book
.
has_cover
=
0
else
:
flash
(
error
,
category
=
"error"
)
result
,
error
=
helper
.
save_cover_from_url
(
to_save
[
"cover_url"
],
book
.
path
)
if
result
is
True
:
book
.
has_cover
=
1
modif_date
=
True
else
:
flash
(
error
,
category
=
"error"
)
# Add default series_index to book
modif_date
|=
edit_book_series_index
(
to_save
[
"series_index"
],
book
)
...
...
cps/static/js/get_meta.js
View file @
42c13ae1
...
...
@@ -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"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment