Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WHISTLE-42: also ensure the upload file name is unique

  • Loading branch information...
commit c54dc985ad064a8466df498567f583fe3c4e9706 1 parent cb996b4
@k-anderson k-anderson authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 whistle_apps/apps/crossbar/src/v1_util.erl
View
8 whistle_apps/apps/crossbar/src/v1_util.erl
@@ -197,7 +197,9 @@ extract_file(Context, ContentType, Req0) ->
,{<<"contents">>, FileContents}
]),
lager:debug("request is a file upload of type: ~s", [ContentType]),
- {Context#cb_context{req_files=[{<<"uploaded_file">>, FileJObj}]}, Req2}
+ FileName = <<"uploaded_file_"
+ ,(wh_util:to_binary(wh_util:current_tstamp()))/binary>>,
+ {Context#cb_context{req_files=[{FileName, FileJObj}]}, Req2}
end
end.
@@ -219,7 +221,9 @@ decode_base64(Context, CT, Req0) ->
,{<<"contents">>, FileContents}
]),
lager:debug("request is a base64 file upload of type: ~s", [ContentType]),
- {Context#cb_context{req_files=[{<<"uploaded_file">>, FileJObj}]}, Req1}
+ FileName = <<"uploaded_file_"
+ ,(wh_util:to_binary(wh_util:current_tstamp()))/binary>>,
+ {Context#cb_context{req_files=[{FileName, FileJObj}]}, Req1}
end.
-spec decode_base64/1 :: (ne_binary()) -> {undefined | ne_binary(), ne_binary()}.
Please sign in to comment.
Something went wrong with that request. Please try again.