Skip to content

Commit

Permalink
Clone configuration in Url.clone()
Browse files Browse the repository at this point in the history
  • Loading branch information
nitzanj authored Nov 5, 2018
1 parent 1fe5dba commit c447b5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cloudinary-core/src/main/java/com/cloudinary/Url.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Url(Cloudinary cloudinary) {

public Url clone() {
Url cloned = cloudinary.url();

cloned.config.update(config.asMap());
cloned.fallbackContent = this.fallbackContent;
cloned.format = this.format;
cloned.posterSource = this.posterSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.cloudinary.Cloudinary;
import com.cloudinary.ResponsiveBreakpoint;
import com.cloudinary.Transformation;
import com.cloudinary.Url;
import com.cloudinary.transformation.*;
import com.cloudinary.utils.ObjectUtils;
import junitparams.JUnitParamsRunner;
Expand Down Expand Up @@ -1159,5 +1160,10 @@ public static Map<String, String> getUrlParameters(URI uri) throws UnsupportedEn
return params;
}


@Test
public void testUrlCloneConfig(){
// verify that secure (from url.config) is cloned as well:
Url url = cloudinary.url().cloudName("cloud").format("frmt").publicId("123").secure(true);
assertEquals("https://res.cloudinary.com/cloud/image/upload/123.frmt", url.clone().generate());
}
}

0 comments on commit c447b5c

Please sign in to comment.