mime.ex (1588B)
1 defmodule Plug.MIME do 2 @moduledoc false 3 4 if Application.compile_env(:plug, :mimes) do 5 IO.puts(:stderr, """ 6 warning: you have set the :mimes configuration for the :plug 7 application but it is no longer supported. Instead of: 8 9 config :plug, :mimes, %{...} 10 11 You must write: 12 13 config :mime, :types, %{...} 14 15 After adding the configuration, MIME needs to be recompiled. 16 If you are using mix, it can be done with: 17 18 $ mix deps.clean mime --build 19 $ mix deps.get 20 21 """) 22 end 23 24 @deprecated "Use MIME.extensions(type) != [] instead" 25 def valid?(type) do 26 IO.puts( 27 :stderr, 28 "Plug.MIME.valid?/1 is deprecated, please use MIME.extensions(type) != [] instead\n" <> 29 Exception.format_stacktrace() 30 ) 31 32 MIME.extensions(type) != [] 33 end 34 35 @deprecated "Use MIME.extensions/1 instead" 36 def extensions(type) do 37 IO.puts( 38 :stderr, 39 "Plug.MIME.extensions/1 is deprecated, please use MIME.extensions/1 instead\n" <> 40 Exception.format_stacktrace() 41 ) 42 43 MIME.extensions(type) 44 end 45 46 @deprecated "Use MIME.type/1 instead" 47 def type(file_extension) do 48 IO.puts( 49 :stderr, 50 "Plug.MIME.type/1 is deprecated, please use MIME.type/1 instead\n" <> 51 Exception.format_stacktrace() 52 ) 53 54 MIME.type(file_extension) 55 end 56 57 @deprecated "Use MIME.from_path/1 instead" 58 def path(path) do 59 IO.puts( 60 :stderr, 61 "Plug.MIME.path/1 is deprecated, please use MIME.from_path/1 instead\n" <> 62 Exception.format_stacktrace() 63 ) 64 65 MIME.from_path(path) 66 end 67 end