escape quotation marks in Content-Disposition header
authorrinpatch <rinpatch@sdf.org>
Tue, 12 Mar 2019 06:21:13 +0000 (09:21 +0300)
committerrinpatch <rinpatch@sdf.org>
Tue, 12 Mar 2019 06:21:13 +0000 (09:21 +0300)
lib/pleroma/plugs/uploaded_media.ex

index 15f447ded319d97767592f0ffb17b999d40b1fac..bc913f4087e8ddc61ca74ed4b0f4a15c0b2fa48f 100644 (file)
@@ -27,6 +27,8 @@ defmodule Pleroma.Plugs.UploadedMedia do
     conn =
       case fetch_query_params(conn) do
         %{query_params: %{"name" => name}} = conn ->
+          name = String.replace(name, "\"", "\\\"")
+
           conn
           |> put_resp_header("Content-Disposition", "filename=\"#{name}\"")