25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

mod_http_upload: Expand 'docroot' before using it

Expand the @HOME@ keyword within the 'docroot' value before setting the
permissions of the document root directory.
This commit is contained in:
Holger Weiss 2016-02-20 18:21:38 +01:00
parent 9db9cbd814
commit b971449f12

View File

@ -273,6 +273,7 @@ init({ServerHost, Opts}) ->
Thumbnail = gen_mod:get_opt(thumbnail, Opts, Thumbnail = gen_mod:get_opt(thumbnail, Opts,
fun(B) when is_boolean(B) -> B end, fun(B) when is_boolean(B) -> B end,
true), true),
DocRoot1 = expand_home(str:strip(DocRoot, right, $/)),
case ServiceURL of case ServiceURL of
undefined -> undefined ->
ok; ok;
@ -289,7 +290,7 @@ init({ServerHost, Opts}) ->
undefined -> undefined ->
ok; ok;
Mode -> Mode ->
file:change_mode(DocRoot, Mode) file:change_mode(DocRoot1, Mode)
end, end,
case Thumbnail of case Thumbnail of
true -> true ->
@ -309,7 +310,7 @@ init({ServerHost, Opts}) ->
secret_length = SecretLength, jid_in_url = JIDinURL, secret_length = SecretLength, jid_in_url = JIDinURL,
file_mode = FileMode, dir_mode = DirMode, file_mode = FileMode, dir_mode = DirMode,
thumbnail = Thumbnail, thumbnail = Thumbnail,
docroot = expand_home(str:strip(DocRoot, right, $/)), docroot = DocRoot1,
put_url = expand_host(str:strip(PutURL, right, $/), ServerHost), put_url = expand_host(str:strip(PutURL, right, $/), ServerHost),
get_url = expand_host(str:strip(GetURL, right, $/), ServerHost), get_url = expand_host(str:strip(GetURL, right, $/), ServerHost),
service_url = ServiceURL}}. service_url = ServiceURL}}.