From 5ab3876814bcbcbfb94e00054b3d1e131fd0b776 Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Tue, 22 Aug 2023 15:47:05 +0530 Subject: [PATCH] fix for html rte asset reference --- packages/contentstack-import/package.json | 2 +- .../contentstack-import/src/utils/asset-helper.ts | 15 ++++++++++++++- packages/contentstack/package.json | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 74317fabf4..0a6f07f064 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-import", "description": "Contentstack CLI plugin to import content into stack", - "version": "1.8.0", + "version": "1.8.1", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack-import/src/utils/asset-helper.ts b/packages/contentstack-import/src/utils/asset-helper.ts index c8fa8cb1ea..6b46050c42 100644 --- a/packages/contentstack-import/src/utils/asset-helper.ts +++ b/packages/contentstack-import/src/utils/asset-helper.ts @@ -85,6 +85,9 @@ export const lookupAssets = function ( ) { parent.push(schema[i].uid); findFileUrls(schema[i], entryToFind, assetUrls); + if (schema[i].field_metadata.rich_text_type) { + findAssetIdsFromHtmlRte(entryToFind, schema[i]); + } parent.pop(); } if (schema[i].data_type === 'group' || schema[i].data_type === 'global_field') { @@ -145,6 +148,15 @@ export const lookupAssets = function ( }); } + function findAssetIdsFromHtmlRte(entryObj: any, ctSchema: any) { + const regex = /