Move MIME under MobilizonWeb context
This commit is contained in:
parent
bc5a9ed99d
commit
76ed2b69a2
@ -3,7 +3,7 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/mime.ex
|
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/mime.ex
|
||||||
|
|
||||||
defmodule Mobilizon.MIME do
|
defmodule MobilizonWeb.MIME do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Returns the mime-type of a binary and optionally a normalized file-name.
|
Returns the mime-type of a binary and optionally a normalized file-name.
|
||||||
"""
|
"""
|
@ -36,6 +36,8 @@ defmodule MobilizonWeb.Upload do
|
|||||||
|
|
||||||
alias Mobilizon.Config
|
alias Mobilizon.Config
|
||||||
|
|
||||||
|
alias MobilizonWeb.MIME
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@type source ::
|
@type source ::
|
||||||
@ -140,7 +142,7 @@ defmodule MobilizonWeb.Upload do
|
|||||||
|
|
||||||
defp prepare_upload(%Plug.Upload{} = file, opts) do
|
defp prepare_upload(%Plug.Upload{} = file, opts) do
|
||||||
with {:ok, size} <- check_file_size(file.path, opts.size_limit),
|
with {:ok, size} <- check_file_size(file.path, opts.size_limit),
|
||||||
{:ok, content_type, name} <- Mobilizon.MIME.file_mime_type(file.path, file.filename) do
|
{:ok, content_type, name} <- MIME.file_mime_type(file.path, file.filename) do
|
||||||
{:ok,
|
{:ok,
|
||||||
%__MODULE__{
|
%__MODULE__{
|
||||||
id: UUID.generate(),
|
id: UUID.generate(),
|
||||||
|
Loading…
Reference in New Issue
Block a user