Skip to content

Commit f485a2e

Browse files
author
Blair McKenzie
committed
refactor of cloudinary check
1 parent 302f71e commit f485a2e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/lib/cloudinary.cfc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ component {
146146

147147
return format;
148148
}
149+
150+
public boolean function isCloudinaryURL(required string sourceURL) {
151+
return refindnocase("^//" & replace(getAPIDomain(),'.','\.','ALL') & "/[^/]+/image/fetch/", imageURL) gte 0;
152+
}
149153

150154
public string function fetch(required struct cropParams, required string sourceURL) {
151155

@@ -157,7 +161,7 @@ component {
157161
var fetchURL = "";
158162
var imageURL = arguments.sourceURL;
159163

160-
if (refindnocase("^//" & replace(getAPIDomain(),'.','\.','ALL') & "/[^/]+/image/fetch/", imageURL)){
164+
if (isCloudinaryURL(arguments.sourceURL)){
161165
// splice a new transform into an existing Cloudinary URL
162166

163167
oldTransform = rereplace(imageURL, "^//" & replace(getAPIDomain(),'.','\.','ALL') & "/[^/]+/image/fetch/(.*)/https?://.*$","\1");

0 commit comments

Comments
 (0)