@@ -27,23 +27,24 @@ public Map callApi(String action, Map<String, Object> params, Map options, Objec
2727 }
2828 boolean returnError = ObjectUtils .asBoolean (options .get ("return_error" ), false );
2929
30- String apiKey = ObjectUtils .asString (options .get ("api_key" ), this .cloudinary ().config .apiKey );
31- if (apiKey == null )
32- throw new IllegalArgumentException ("Must supply api_key" );
33-
3430 if (Boolean .TRUE .equals (options .get ("unsigned" ))) {
3531 // Nothing to do
36- } else if (options .containsKey ("signature" ) && options .containsKey ("timestamp" )) {
37- params .put ("timestamp" , options .get ("timestamp" ));
38- params .put ("signature" , options .get ("signature" ));
39- params .put ("api_key" , apiKey );
4032 } else {
41- String apiSecret = ObjectUtils .asString (options .get ("api_secret" ), this .cloudinary ().config .apiSecret );
42- if (apiSecret == null )
43- throw new IllegalArgumentException ("Must supply api_secret" );
44- params .put ("timestamp" , Long .valueOf (System .currentTimeMillis () / 1000L ).toString ());
45- params .put ("signature" , this .cloudinary ().apiSignRequest (params , apiSecret ));
46- params .put ("api_key" , apiKey );
33+ String apiKey = ObjectUtils .asString (options .get ("api_key" ), this .cloudinary ().config .apiKey );
34+ if (apiKey == null )
35+ throw new IllegalArgumentException ("Must supply api_key" );
36+ if (options .containsKey ("signature" ) && options .containsKey ("timestamp" )) {
37+ params .put ("timestamp" , options .get ("timestamp" ));
38+ params .put ("signature" , options .get ("signature" ));
39+ params .put ("api_key" , apiKey );
40+ } else {
41+ String apiSecret = ObjectUtils .asString (options .get ("api_secret" ), this .cloudinary ().config .apiSecret );
42+ if (apiSecret == null )
43+ throw new IllegalArgumentException ("Must supply api_secret" );
44+ params .put ("timestamp" , Long .valueOf (System .currentTimeMillis () / 1000L ).toString ());
45+ params .put ("signature" , this .cloudinary ().apiSignRequest (params , apiSecret ));
46+ params .put ("api_key" , apiKey );
47+ }
4748 }
4849 String apiUrl = this .cloudinary ().cloudinaryApiUrl (action , options );
4950 MultipartUtility multipart = new MultipartUtility (apiUrl , "UTF-8" , this .cloudinary ().randomPublicId (), (String ) options .get ("content_range" ));
0 commit comments