2018-11-06 09:30:27 +00:00
|
|
|
defmodule MobilizonWeb.UploadPlug do
|
2019-01-03 13:59:59 +00:00
|
|
|
@moduledoc """
|
|
|
|
Plug to intercept uploads
|
|
|
|
"""
|
2018-11-06 09:30:27 +00:00
|
|
|
use Plug.Builder
|
|
|
|
|
|
|
|
plug(Plug.Static,
|
|
|
|
at: "/",
|
|
|
|
from: {:mobilizon, "./uploads"}
|
|
|
|
)
|
|
|
|
|
|
|
|
# only: ~w(images robots.txt)
|
|
|
|
plug(:not_found)
|
|
|
|
|
|
|
|
def not_found(conn, _) do
|
|
|
|
send_resp(conn, 404, "not found")
|
|
|
|
end
|
|
|
|
end
|