@aptly-as/sdk-web
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -78,3 +78,3 @@ import { getImageSets } from './media.sets.js'; | ||
const replace = [`w_${width}`, ...urlOptions].join(','); | ||
return cloudUrl.replace(/\/(v[^\/]*)\//, `/${areaOptions}${replace}/`); | ||
return cloudUrl.replace(/\/upload\//, `/upload/${areaOptions}${replace}/`); | ||
} | ||
@@ -88,4 +88,16 @@ getUrl(url) { | ||
return undefined; | ||
return cloudUrl.startsWith('http') ? cloudUrl : `https://res.cloudinary.com/${this.cloudinaryKey}/image/upload/vOptions/${cloudUrl}`; | ||
let key = this.cloudinaryKey; | ||
let id = cloudUrl; | ||
if (cloudUrl.startsWith('http')) { | ||
const match = cloudUrl.match(/cloudinary.com\/([^\/]*)\//); | ||
if (match) { | ||
key = match[1]; | ||
id = cloudUrl.substring(cloudUrl.lastIndexOf('/') + 1); | ||
} | ||
else { | ||
return cloudUrl; | ||
} | ||
} | ||
return `https://res.cloudinary.com/${key}/image/upload/${id}`; | ||
} | ||
} |
{ | ||
"name": "@aptly-as/sdk-web", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Aptly SDK library for web applications", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"source": "lib/index.html", | ||
"engines": { | ||
@@ -9,0 +8,0 @@ "node": ">14.0.0 <17.0.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35991
232