2018-11-06 10:30:27 +01:00
|
|
|
defmodule MobilizonWeb.UploadPlug do
|
2019-01-03 14:59:59 +01:00
|
|
|
@moduledoc """
|
|
|
|
Plug to intercept uploads
|
|
|
|
"""
|
2018-11-06 10:30:27 +01: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
|