Skip to content

Commit 9e91064

Browse files
authored
Support filename_override upload parameter
1 parent 95d2b33 commit 9e91064

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public static final Map<String, Object> buildUploadParams(Map options) {
3535
params.put("allowed_formats", StringUtils.join(ObjectUtils.asArray(options.get("allowed_formats")), ","));
3636
params.put("moderation", options.get("moderation"));
3737
params.put("access_mode", (String) options.get("access_mode"));
38+
params.put("filename_override", (String) options.get("filename_override"));
39+
3840
Object responsive_breakpoints = options.get("responsive_breakpoints");
3941
if (responsive_breakpoints != null) {
4042
params.put("responsive_breakpoints", JSONObject.wrap(responsive_breakpoints));

cloudinary-test-common/src/main/java/com/cloudinary/test/AbstractUploaderTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,14 @@ public void testFilenameOption() throws Exception {
562562
assertEquals("emanelif", result.get("original_filename"));
563563
}
564564

565+
566+
@Test
567+
public void testFilenameOverrideOption() throws Exception {
568+
Map result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("filename_override", "overridden", "tags", Arrays.asList(SDK_TEST_TAG, UPLOADER_TAG)));
569+
assertEquals("overridden", result.get("original_filename"));
570+
}
571+
572+
565573
@Test
566574
public void testResponsiveBreakpoints() throws Exception {
567575
ResponsiveBreakpoint breakpoint = new ResponsiveBreakpoint()

0 commit comments

Comments
 (0)