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
56ee8c56
Commit
56ee8c56
authored
Jan 05, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1122
(Uploading books with applied language restriction leads no longer to error 500)
parent
8ad84a7c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
editbooks.py
cps/editbooks.py
+10
-2
No files found.
cps/editbooks.py
View file @
56ee8c56
...
...
@@ -656,10 +656,16 @@ def upload():
db_language
=
db
.
Languages
(
input_language
)
db
.
session
.
add
(
db_language
)
# If the language of the file is excluded from the users view, it's not imported, to allow the user to view
# the book it's language is set to the filter language
if
db_language
!=
current_user
.
filter_language
()
and
current_user
.
filter_language
()
!=
"all"
:
db_language
=
db
.
session
.
query
(
db
.
Languages
)
.
\
filter
(
db
.
Languages
.
lang_code
==
current_user
.
filter_language
())
.
first
()
# combine path and normalize path from windows systems
path
=
os
.
path
.
join
(
author_dir
,
title_dir
)
.
replace
(
'
\\
'
,
'/'
)
db_book
=
db
.
Books
(
title
,
""
,
db_author
.
sort
,
datetime
.
datetime
.
now
(),
datetime
.
datetime
(
101
,
1
,
1
),
series_index
,
datetime
.
datetime
.
now
(),
path
,
has_cover
,
db_author
,
[],
db_language
)
series_index
,
datetime
.
datetime
.
now
(),
path
,
has_cover
,
db_author
,
[],
db_language
)
db_book
.
authors
.
append
(
db_author
)
if
db_series
:
db_book
.
series
.
append
(
db_series
)
...
...
@@ -688,7 +694,9 @@ def upload():
# save data to database, reread data
db
.
session
.
commit
()
db
.
update_title_sort
(
config
)
book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book_id
)
.
filter
(
common_filters
())
.
first
()
# Reread book. It's important not to filter the result, as it could have language which hide it from
# current users view (tags are not stored/extracted from metadata and could also be limited)
book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book_id
)
.
first
()
# upload book to gdrive if nesseccary and add "(bookid)" to folder name
if
config
.
config_use_google_drive
:
...
...
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