From 81d792b7f65195db56459fa389a9f2f1fc3b8a9c Mon Sep 17 00:00:00 2001 From: lazedo Date: Fri, 4 Mar 2016 12:27:43 +0000 Subject: [PATCH] allow video recording and use kz_mime --- core/whistle_media/src/wh_media_store_proxy.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/whistle_media/src/wh_media_store_proxy.erl b/core/whistle_media/src/wh_media_store_proxy.erl index 5ae9cbe6268..82896fbad87 100644 --- a/core/whistle_media/src/wh_media_store_proxy.erl +++ b/core/whistle_media/src/wh_media_store_proxy.erl @@ -159,6 +159,9 @@ is_appropriate_content_type(Path, Req0) -> {<<"audio/", _/binary>> = CT, Req1}-> lager:debug("found content-type via header: ~s", [CT]), ensure_extension_present(Path, CT, Req1); + {<<"video/", _/binary>> = CT, Req1}-> + lager:debug("found content-type via header: ~s", [CT]), + ensure_extension_present(Path, CT, Req1); {_CT, Req1} -> lager:debug("inappropriate content-type via headers: ~s", [_CT]), is_appropriate_extension(Path, Req1) @@ -168,10 +171,13 @@ is_appropriate_content_type(Path, Req0) -> {'ok', cowboy_req:req(), 'ok'}. is_appropriate_extension(#media_store_path{att=Attachment}=Path, Req0) -> Extension = filename:extension(Attachment), - case wh_mime_types:from_extension(Extension) of + case kz_mime:from_extension(Extension) of <<"audio/", _/binary>> = CT-> lager:debug("found content-type via extension: ~s", [CT]), try_to_store(Path, CT, Req0); + <<"video/", _/binary>> = CT-> + lager:debug("found content-type via extension: ~s", [CT]), + try_to_store(Path, CT, Req0); _CT -> lager:debug("inappropriate content-type via extension: ~s", [_CT]), {'ok', Req1} = cowboy_req:reply(415, Req0), @@ -182,7 +188,7 @@ is_appropriate_extension(#media_store_path{att=Attachment}=Path, Req0) -> {'ok', cowboy_req:req(), 'ok'}. ensure_extension_present(#media_store_path{att=Attachment}=Path, CT, Req0) -> case wh_util:is_empty(filename:extension(Attachment)) - andalso wh_mime_types:to_extension(CT) + andalso kz_mime:to_extension(CT) of 'false' -> try_to_store(Path, CT, Req0);