File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
test/java/com/cloudinary/test Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -589,11 +589,11 @@ public String generate(Map options) {
589589 String flags = StringUtils .join (ObjectUtils .asArray (options .get ("flags" )), "." );
590590
591591 String duration = normRangeValue (options .get ("duration" ));
592- String startOffset = normRangeValue (options .get ("start_offset" ));
592+ String startOffset = normAutoRangeValue (options .get ("start_offset" ));
593593 String endOffset = normRangeValue (options .get ("end_offset" ));
594594 String [] offset = splitRange (options .get ("offset" ));
595595 if (offset != null ) {
596- startOffset = normRangeValue (offset [0 ]);
596+ startOffset = normAutoRangeValue (offset [0 ]);
597597 endOffset = normRangeValue (offset [1 ]);
598598 }
599599
@@ -797,6 +797,13 @@ private static String normRangeValue(Object objectValue) {
797797 return matcher .group (1 ) + modifier ;
798798 }
799799
800+ private static String normAutoRangeValue (Object objectValue ) {
801+ if ("auto" .equals (objectValue )) {
802+ return objectValue .toString ();
803+ }
804+ return normRangeValue (objectValue );
805+ }
806+
800807 private static String processVideoCodecParam (Object param ) {
801808 StringBuilder outParam = new StringBuilder ();
802809 if (param instanceof String ) {
Original file line number Diff line number Diff line change @@ -728,6 +728,9 @@ public void testStartOffset() {
728728 actual = cloudinary .url ().resourceType ("video" ).transformation (new Transformation ().startOffsetPercent (2.63 ))
729729 .generate ("video_id" );
730730 assertEquals (VIDEO_UPLOAD_PATH + "so_2.63p/video_id" , actual );
731+ actual = cloudinary .url ().resourceType ("video" ).transformation (new Transformation ().startOffset ("auto" ))
732+ .generate ("video_id" );
733+ assertEquals (VIDEO_UPLOAD_PATH + "so_auto/video_id" , actual );
731734 }
732735
733736 @ Test
You can’t perform that action at this time.
0 commit comments