Allow getting uploads as non-chunked
This commit is contained in:
parent
16c84189c3
commit
a1dad5d71d
|
@ -136,11 +136,18 @@ defmodule WikiWeb.PageController do
|
|||
redirect(conn, to: Routes.page_path(conn, :edit, page.id))
|
||||
end
|
||||
|
||||
def get_upload(conn, _params) do
|
||||
def get_upload(conn, params) do
|
||||
upload = conn.assigns.upload
|
||||
key = get_session(conn, :content_encryption_key)
|
||||
key = Base.decode16!(key, case: :lower)
|
||||
|
||||
if Map.get(params, "oneshot") do
|
||||
data = Upload.decrypt_content(upload, key)
|
||||
|
||||
conn
|
||||
|> put_resp_header("content-type", upload.content_type)
|
||||
|> send_resp(200, data)
|
||||
else
|
||||
conn =
|
||||
conn
|
||||
|> put_resp_header("content-type", upload.content_type)
|
||||
|
@ -158,6 +165,7 @@ defmodule WikiWeb.PageController do
|
|||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
def delete_upload(conn, _params) do
|
||||
page = conn.assigns.page
|
||||
|
|
Loading…
Reference in New Issue