@contentstack/cli-cm-import 1.14.2 → 1.14.3
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/README.md +1 -1
- package/lib/utils/asset-helper.js +3 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
|
|
|
47
47
|
$ csdx COMMAND
|
|
48
48
|
running command...
|
|
49
49
|
$ csdx (--version)
|
|
50
|
-
@contentstack/cli-cm-import/1.14.
|
|
50
|
+
@contentstack/cli-cm-import/1.14.3 linux-x64 node-v18.19.1
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -11,6 +11,7 @@ let _ = require('lodash');
|
|
|
11
11
|
let { marked } = require('marked');
|
|
12
12
|
let helper = require('./file-helper');
|
|
13
13
|
const MAX_RETRY_LIMIT = 5;
|
|
14
|
+
const escapeRegExp = (str) => str.replace(/[*+?^${}()|[\]\\]/g, '\\$&');
|
|
14
15
|
function validate(req) {
|
|
15
16
|
if (typeof req !== 'object') {
|
|
16
17
|
throw new Error(`Invalid params passed for request\n${JSON.stringify(arguments)}`);
|
|
@@ -234,8 +235,8 @@ const lookupAssets = function (data, mappedAssetUids, mappedAssetUrls, assetUidM
|
|
|
234
235
|
assetUrls.forEach(function (assetUrl) {
|
|
235
236
|
let mappedAssetUrl = mappedAssetUrls[assetUrl];
|
|
236
237
|
if (typeof mappedAssetUrl !== 'undefined') {
|
|
237
|
-
const sanitizedUrl = (
|
|
238
|
-
const escapedMappedUrl = (
|
|
238
|
+
const sanitizedUrl = escapeRegExp(assetUrl).replace(/\.\./g, '\\$&');
|
|
239
|
+
const escapedMappedUrl = escapeRegExp(mappedAssetUrl).replace(/\.\./g, '\\$&');
|
|
239
240
|
entry = entry.replace(new RegExp(sanitizedUrl, 'img'), escapedMappedUrl);
|
|
240
241
|
matchedUrls.push(mappedAssetUrl);
|
|
241
242
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED