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
d02f1120
Commit
d02f1120
authored
Mar 15, 2019
by
rinpatch
Browse files
Content-Disposition regex improvements
parent
958227d5
Pipeline
#9002
passed with stages
in 4 minutes and 23 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/reverse_proxy.ex
View file @
d02f1120
...
...
@@ -316,9 +316,9 @@ defp build_resp_content_disposition_header(headers, opts) do
{{
"content-disposition"
,
content_disposition_string
},
_
}
=
List
.
keytake
(
headers
,
"content-disposition"
,
0
)
[
name
]
=
[
name
|
_
]
=
Regex
.
run
(
~r/filename=
\
"(
.
*)
\
"/u
,
~r/filename="(
(?:[^"\\]|\\.)
*)"/u
,
content_disposition_string
||
""
,
capture:
:all_but_first
)
...
...
@@ -328,7 +328,7 @@ defp build_resp_content_disposition_header(headers, opts) do
MatchError
->
Keyword
.
get
(
opts
,
:attachment_name
,
"attachment"
)
end
disposition
=
"attachment; filename=
"
<>
name
disposition
=
"attachment; filename=
\"
#{
name
}
\"
"
List
.
keystore
(
headers
,
"content-disposition"
,
0
,
{
"content-disposition"
,
disposition
})
else
...
...
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