forked from AkkomaGang/akkoma
Content-Disposition regex improvements
This commit is contained in:
parent
958227d556
commit
d02f1120f9
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue