Skip to content

Commit 87fc743

Browse files
author
Daniel Cohen
committed
merged android signature fix
1 parent a811982 commit 87fc743

File tree

1 file changed

+25
-14
lines changed
  • cloudinary-core/src/main/java/com/cloudinary

1 file changed

+25
-14
lines changed

cloudinary-core/src/main/java/com/cloudinary/Util.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ public static final Map<String, Object> buildUploadParams(Map options) {
1818
if (options == null)
1919
options = ObjectUtils.emptyMap();
2020
Map<String, Object> params = new HashMap<String, Object>();
21-
Object transformation = options.get("transformation");
22-
if (transformation != null) {
23-
if (transformation instanceof Transformation) {
24-
transformation = ((Transformation) transformation).generate();
25-
}
26-
params.put("transformation", transformation.toString());
27-
}
21+
2822
params.put("public_id", (String) options.get("public_id"));
2923
params.put("callback", (String) options.get("callback"));
3024
params.put("format", (String) options.get("format"));
@@ -34,22 +28,39 @@ public static final Map<String, Object> buildUploadParams(Map options) {
3428
if (value != null)
3529
params.put(attr, value.toString());
3630
}
37-
Object eagerObj = options.get("eager");
38-
String eager = eagerObj instanceof String ? eagerObj.toString() : buildEager((List<Transformation>) options.get("eager"));
3931

40-
params.put("eager", eager);
4132
params.put("notification_url", (String) options.get("notification_url"));
4233
params.put("eager_notification_url", (String) options.get("eager_notification_url"));
4334
params.put("proxy", (String) options.get("proxy"));
4435
params.put("folder", (String) options.get("folder"));
4536
params.put("allowed_formats", StringUtils.join(ObjectUtils.asArray(options.get("allowed_formats")), ","));
4637
params.put("moderation", options.get("moderation"));
4738
params.put("upload_preset", options.get("upload_preset"));
48-
if (options.get("tags") != null) {
49-
params.put("tags", StringUtils.join(ObjectUtils.asArray(options.get("tags")), ","));
50-
}
5139

52-
processWriteParameters(options, params);
40+
if (options.get("signature") == null) {
41+
params.put("eager", buildEager((List<Transformation>) options.get("eager")));
42+
Object transformation = options.get("transformation");
43+
if (transformation != null) {
44+
if (transformation instanceof Transformation) {
45+
transformation = ((Transformation) transformation).generate();
46+
}
47+
params.put("transformation", transformation.toString());
48+
}
49+
processWriteParameters(options, params);
50+
} else {
51+
params.put("eager", (String) options.get("eager"));
52+
params.put("transformation", (String) options.get("transformation"));
53+
params.put("headers", (String) options.get("headers"));
54+
params.put("tags", (String) options.get("tags"));
55+
params.put("face_coordinates", (String) options.get("face_coordinates"));
56+
params.put("context", (String) options.get("context"));
57+
params.put("ocr", (String) options.get("ocr"));
58+
params.put("raw_convert", (String) options.get("raw_convert"));
59+
params.put("categorization", (String) options.get("categorization"));
60+
params.put("detection", (String) options.get("detection"));
61+
params.put("similarity_search", (String) options.get("similarity_search"));
62+
params.put("auto_tagging", (String) options.get("auto_tagging"));
63+
}
5364
return params;
5465
}
5566

0 commit comments

Comments
 (0)