@capillarytech/creatives-library 7.12.117 → 7.12.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -149,7 +149,7 @@ export const getCdnUrl = ({
|
|
|
149
149
|
let CREATIVES_S3_BUCKET_PATH = getLocalStorageItem(CREATIVES_S3_BUCKET_PATH_KEY);
|
|
150
150
|
|
|
151
151
|
//remove all leading and trailing forward slash with empty string, if leading/trailing forward slash is present in node env by mistake then url will not be correct hence removing them.
|
|
152
|
-
CREATIVES_S3_BUCKET_PATH = CREATIVES_S3_BUCKET_PATH
|
|
152
|
+
CREATIVES_S3_BUCKET_PATH = CREATIVES_S3_BUCKET_PATH?.replace(/^\/|\/$/g, '');
|
|
153
153
|
|
|
154
154
|
//Basic validations on data stored in local storage.
|
|
155
155
|
if (
|
|
@@ -260,6 +260,9 @@ export const getCdnUrl = ({
|
|
|
260
260
|
* @returns htmlContents with updated urls in image tag
|
|
261
261
|
*/
|
|
262
262
|
export const updateImagesInHtml = (htmlContents) => {
|
|
263
|
+
if(!htmlContents || typeof htmlContents !== "string"){
|
|
264
|
+
return htmlContents;
|
|
265
|
+
}
|
|
263
266
|
const copiedHtmlContents = htmlContents;
|
|
264
267
|
try {
|
|
265
268
|
const root = parse(htmlContents);
|
|
@@ -194,6 +194,12 @@ describe("cdnTransformationTests", () => {
|
|
|
194
194
|
const expected = mockdata.emailRawTransformed;
|
|
195
195
|
expect(htmlContentsOutput).toEqual(expected);
|
|
196
196
|
});
|
|
197
|
+
|
|
198
|
+
it("should return input itself if input is either among undefined/null/empty string", () => {
|
|
199
|
+
expect(cdnUtils.updateImagesInHtml(undefined)).toEqual(undefined);
|
|
200
|
+
expect(cdnUtils.updateImagesInHtml(null)).toEqual(null);
|
|
201
|
+
expect(cdnUtils.updateImagesInHtml("")).toEqual("");
|
|
202
|
+
});
|
|
197
203
|
});
|
|
198
204
|
|
|
199
205
|
describe("transformEmailTemplate()", () => {
|