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
17622c1f
Commit
17622c1f
authored
Mar 26, 2016
by
Jan Broer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix download error when book title contains non-latin characters (e.g. Chinese)
parent
f163ef22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
web.py
cps/web.py
+16
-2
No files found.
cps/web.py
View file @
17622c1f
...
@@ -212,7 +212,14 @@ def get_opds_download_link(book_id, format):
...
@@ -212,7 +212,14 @@ def get_opds_download_link(book_id, format):
file_name
=
author
+
'-'
+
file_name
file_name
=
author
+
'-'
+
file_name
file_name
=
helper
.
get_valid_filename
(
file_name
)
file_name
=
helper
.
get_valid_filename
(
file_name
)
response
=
make_response
(
send_from_directory
(
os
.
path
.
join
(
config
.
DB_ROOT
,
book
.
path
),
data
.
name
+
"."
+
format
))
response
=
make_response
(
send_from_directory
(
os
.
path
.
join
(
config
.
DB_ROOT
,
book
.
path
),
data
.
name
+
"."
+
format
))
response
.
headers
[
"Content-Disposition"
]
=
"attachment; filename=
%
s.
%
s"
%
(
file_name
,
format
)
#response.headers["Content-Disposition"] = "attachment; filename=%s.%s" % (data.name, format)
response
.
headers
[
"Content-Disposition"
]
=
\
"attachment; "
\
"filename={utf_filename}.{suffix};"
\
"filename*=UTF-8''{utf_filename}.{suffix}"
.
format
(
utf_filename
=
file_name
.
encode
(
'utf-8'
),
suffix
=
format
)
return
response
return
response
@
app
.
route
(
"/"
,
defaults
=
{
'page'
:
1
})
@
app
.
route
(
"/"
,
defaults
=
{
'page'
:
1
})
...
@@ -363,7 +370,14 @@ def get_download_link(book_id, format):
...
@@ -363,7 +370,14 @@ def get_download_link(book_id, format):
file_name
=
author
+
'-'
+
file_name
file_name
=
author
+
'-'
+
file_name
file_name
=
helper
.
get_valid_filename
(
file_name
)
file_name
=
helper
.
get_valid_filename
(
file_name
)
response
=
make_response
(
send_from_directory
(
os
.
path
.
join
(
config
.
DB_ROOT
,
book
.
path
),
data
.
name
+
"."
+
format
))
response
=
make_response
(
send_from_directory
(
os
.
path
.
join
(
config
.
DB_ROOT
,
book
.
path
),
data
.
name
+
"."
+
format
))
response
.
headers
[
"Content-Disposition"
]
=
"attachment; filename=
%
s.
%
s"
%
(
file_name
,
format
)
#response.headers["Content-Disposition"] = "attachment; filename=%s.%s" % (file_name, format)
response
.
headers
[
"Content-Disposition"
]
=
\
"attachment; "
\
"filename={utf_filename}.{suffix};"
\
"filename*=UTF-8''{utf_filename}.{suffix}"
.
format
(
utf_filename
=
file_name
.
encode
(
'utf-8'
),
suffix
=
format
)
return
response
return
response
@
app
.
route
(
'/register'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/register'
,
methods
=
[
'GET'
,
'POST'
])
...
...
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