From 76ed2b69a2f6dbf01330b5665db57a1c56ec7742 Mon Sep 17 00:00:00 2001 From: miffigriffy Date: Fri, 13 Sep 2019 01:35:56 +0200 Subject: [PATCH] Move MIME under MobilizonWeb context --- lib/{mobilizon => mobilizon_web}/mime.ex | 2 +- lib/mobilizon_web/upload.ex | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) rename lib/{mobilizon => mobilizon_web}/mime.ex (99%) diff --git a/lib/mobilizon/mime.ex b/lib/mobilizon_web/mime.ex similarity index 99% rename from lib/mobilizon/mime.ex rename to lib/mobilizon_web/mime.ex index 12ea8f46f..49739915a 100644 --- a/lib/mobilizon/mime.ex +++ b/lib/mobilizon_web/mime.ex @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/mime.ex -defmodule Mobilizon.MIME do +defmodule MobilizonWeb.MIME do @moduledoc """ Returns the mime-type of a binary and optionally a normalized file-name. """ diff --git a/lib/mobilizon_web/upload.ex b/lib/mobilizon_web/upload.ex index b245f74b6..71f16d6e7 100644 --- a/lib/mobilizon_web/upload.ex +++ b/lib/mobilizon_web/upload.ex @@ -36,6 +36,8 @@ defmodule MobilizonWeb.Upload do alias Mobilizon.Config + alias MobilizonWeb.MIME + require Logger @type source :: @@ -140,7 +142,7 @@ defmodule MobilizonWeb.Upload do defp prepare_upload(%Plug.Upload{} = file, opts) do 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, %__MODULE__{ id: UUID.generate(),