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
29f6463e
Commit
29f6463e
authored
Feb 16, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1149 (Prevent invalid file extensions on Kindle Paperwhite download)
parent
ed0bdbf3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
helper.py
cps/helper.py
+2
-2
No files found.
cps/helper.py
View file @
29f6463e
...
@@ -798,8 +798,8 @@ def get_download_link(book_id, book_format):
...
@@ -798,8 +798,8 @@ def get_download_link(book_id, book_format):
file_name
=
get_valid_filename
(
file_name
)
file_name
=
get_valid_filename
(
file_name
)
headers
=
Headers
()
headers
=
Headers
()
headers
[
"Content-Type"
]
=
mimetypes
.
types_map
.
get
(
'.'
+
book_format
,
"application/octet-stream"
)
headers
[
"Content-Type"
]
=
mimetypes
.
types_map
.
get
(
'.'
+
book_format
,
"application/octet-stream"
)
headers
[
"Content-Disposition"
]
=
"attachment; filename
*=UTF-8''
%
s.
%
s"
%
(
quote
(
file_name
.
encode
(
'utf-8'
)),
headers
[
"Content-Disposition"
]
=
"attachment; filename
=
%
s.
%
s; filename*=UTF-8''
%
s.
%
s"
%
(
book_format
)
quote
(
file_name
.
encode
(
'utf-8'
)),
book_format
,
quote
(
file_name
.
encode
(
'utf-8'
)),
book_format
)
return
do_download_file
(
book
,
book_format
,
data
,
headers
)
return
do_download_file
(
book
,
book_format
,
data
,
headers
)
else
:
else
:
abort
(
404
)
abort
(
404
)
...
...
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