summaryrefslogtreecommitdiff
path: root/src/mod_http_upload.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-01-15 12:54:57 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-01-15 12:54:57 +0300
commit0f86559d83a37d97e1ce18aa346a67f7d0b391e2 (patch)
tree395977e9872e1a46e791eeeb6bf86f9405b4a25f /src/mod_http_upload.erl
parentMerge pull request #2221 from licaon-kter/patch-1 (diff)
Always build eimp dependency
Even if no suitable C graphics libraries are detected at compile time, the package is still usable because it provides `eimp:get_type/1` which is used by mod_avatar.
Diffstat (limited to 'src/mod_http_upload.erl')
-rw-r--r--src/mod_http_upload.erl28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl
index f7ff56b0..df8362d4 100644
--- a/src/mod_http_upload.erl
+++ b/src/mod_http_upload.erl
@@ -196,7 +196,19 @@ mod_opt_type(custom_headers) ->
mod_opt_type(rm_on_unregister) ->
fun(B) when is_boolean(B) -> B end;
mod_opt_type(thumbnail) ->
- fun(B) when is_boolean(B) -> B end;
+ fun(true) ->
+ case eimp:supported_formats() of
+ [] ->
+ ?WARNING_MSG("ejabberd is built without image converter "
+ "support, option '~s' is ignored",
+ [thumbnail]),
+ erlang:error(badarg);
+ _ ->
+ true
+ end;
+ (false) ->
+ false
+ end;
mod_opt_type(_) ->
[host, hosts, name, access, max_size, secret_length, jid_in_url, file_mode,
dir_mode, docroot, put_url, get_url, service_url, custom_headers,
@@ -237,20 +249,6 @@ init([ServerHost, Opts]) ->
Mode ->
file:change_mode(DocRoot2, Mode)
end,
- case Thumbnail of
- true ->
- case misc:have_eimp() of
- false ->
- ?ERROR_MSG("ejabberd is built without graphics support, "
- "please rebuild it with --enable-graphics or "
- "set 'thumbnail: false' for module '~s' in "
- "ejabberd.yml", [?MODULE]);
- _ ->
- ok
- end;
- false ->
- ok
- end,
lists:foreach(
fun(Host) ->
ejabberd_router:register_route(Host, ServerHost)