Skip to content

Commit 4722c33

Browse files
committed
updated regex to support non prod
1 parent ed0b77f commit 4722c33

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

.env-example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ENVIRONMENT=NON_PROD

.talismanrc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
fileignoreconfig:
2-
- filename: src/utils/config-handler.ts
3-
checksum: a23fb2f3034046f68d0c24de9a50855579bb0bc86cbc6485aec0f315c9a42d77
4-
- filename: src/commands/cm/stacks/export-query.ts
5-
checksum: 0a94bd30d852b2d8acb102eaabf602e397a649a7dc7c671efcb66b56d67dc7b7
2+
- filename: .env-example
3+
checksum: 591f1e672d4df287107092b8fd37c27913e09225c6ced55293e1d459b1119d05
64
version: '1.0'

snyk_output.log

Whitespace-only changes.

src/utils/branch-helper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export const setupBranches = async (config: QueryExportConfig, stackAPIClient: a
4242
.branch()
4343
.query()
4444
.find()
45-
.catch((err: Error): any => {
45+
.catch((): any => {
46+
log(config, 'Stack does not have branches', 'info');
4647
return null;
4748
});
4849

src/utils/referenced-asset-handler.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,21 @@ export class AssetReferenceHandler {
109109
}
110110
}
111111

112+
let assetUrlRegex = '';
113+
let assetUIDMatchIndex;
114+
if (process.env.ENVIRONMENT === 'NON_PROD') {
115+
assetUrlRegex = '(https://.*?/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))';
116+
assetUIDMatchIndex = 3;
117+
} else {
118+
assetUrlRegex =
119+
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-|gcp-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))';
120+
assetUIDMatchIndex = 6;
121+
}
122+
112123
// Pattern 2: Contentstack asset URLs
113-
const urlRegex = new RegExp(
114-
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-|gcp-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
115-
'g',
116-
);
124+
const urlRegex = new RegExp(assetUrlRegex, 'g');
117125
while ((match = urlRegex.exec(content)) !== null) {
118-
const assetUID = match[6]; // The asset UID is in the 6th capture group
126+
const assetUID = match[assetUIDMatchIndex]; // The asset UID is in the 6th capture group
119127
if (assetUID) {
120128
assetUIDs.add(assetUID);
121129
}

0 commit comments

Comments
 (0)