Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
958227d5
Commit
958227d5
authored
Mar 15, 2019
by
rinpatch
Browse files
MediaProxy: parse filename from content-disposition for non-whitelisted types
parent
7ecc2010
Pipeline
#8992
passed with stages
in 7 minutes and 55 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/reverse_proxy.ex
View file @
958227d5
...
...
@@ -311,7 +311,25 @@ defp build_resp_content_disposition_header(headers, opts) do
end
if
attachment?
do
disposition
=
"attachment; filename="
<>
Keyword
.
get
(
opts
,
:attachment_name
,
"attachment"
)
name
=
try
do
{{
"content-disposition"
,
content_disposition_string
},
_
}
=
List
.
keytake
(
headers
,
"content-disposition"
,
0
)
[
name
]
=
Regex
.
run
(
~r/filename=\"(.*)\"/u
,
content_disposition_string
||
""
,
capture:
:all_but_first
)
name
rescue
MatchError
->
Keyword
.
get
(
opts
,
:attachment_name
,
"attachment"
)
end
disposition
=
"attachment; filename="
<>
name
List
.
keystore
(
headers
,
"content-disposition"
,
0
,
{
"content-disposition"
,
disposition
})
else
headers
...
...
Write
Preview
Supports
Markdown
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