Skip to content

Commit 5b2573c

Browse files
authored
Merge pull request #375 from sf-kishore-kurri/u/kkurri/W-18480496
fix: @W-18480496: Avoid cleaning of Language with omniscript inside flexcard
2 parents d348adc + 128e152 commit 5b2573c

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

src/migration/flexcard.ts

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
410410
if (parts.length >= 2) {
411411
// Create both original and cleaned references for comparison
412412
const originalOsRef = parts.join('_');
413-
const cleanedParts = parts.map((p) => this.cleanName(p));
413+
const cleanedParts =
414+
parts.length >= 3
415+
? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
416+
: parts.map((p) => this.cleanName(p));
414417
const cleanedOsRef = cleanedParts.join('_');
415418

416419
// Push original name for consistency
@@ -444,7 +447,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
444447
const parts = omniTypeName.split('/');
445448
if (parts.length >= 2) {
446449
const originalOsRef = parts.join('_');
447-
const cleanedParts = parts.map((p) => this.cleanName(p));
450+
const cleanedParts =
451+
parts.length >= 3
452+
? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
453+
: parts.map((p) => this.cleanName(p));
448454
const cleanedOsRef = cleanedParts.join('_');
449455

450456
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
@@ -473,7 +479,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
473479
if (parts.length >= 2) {
474480
// Create both original and cleaned references for comparison
475481
const originalOsRef = parts.join('_');
476-
const cleanedParts = parts.map((p) => this.cleanName(p));
482+
const cleanedParts =
483+
parts.length >= 3
484+
? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
485+
: parts.map((p) => this.cleanName(p));
477486
const cleanedOsRef = cleanedParts.join('_');
478487

479488
// Push original name for consistency
@@ -518,7 +527,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
518527
if (parts.length >= 2) {
519528
// Create both original and cleaned references for comparison
520529
const originalOsRef = parts.join('_');
521-
const cleanedParts = parts.map((p) => this.cleanName(p));
530+
const cleanedParts =
531+
parts.length >= 3
532+
? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
533+
: parts.map((p) => this.cleanName(p));
522534
const cleanedOsRef = cleanedParts.join('_');
523535

524536
// Push original name for consistency
@@ -548,7 +560,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
548560

549561
if (parts.length >= 2) {
550562
const originalOsRef = parts.join('_');
551-
const cleanedParts = parts.map((p) => this.cleanName(p));
563+
const cleanedParts =
564+
parts.length >= 3
565+
? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
566+
: parts.map((p) => this.cleanName(p));
552567
const cleanedOsRef = cleanedParts.join('_');
553568

554569
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
@@ -575,7 +590,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
575590

576591
if (parts.length >= 2) {
577592
const originalOsRef = parts.join('_');
578-
const cleanedParts = parts.map((p) => this.cleanName(p));
593+
const cleanedParts =
594+
parts.length >= 3
595+
? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
596+
: parts.map((p) => this.cleanName(p));
579597
const cleanedOsRef = cleanedParts.join('_');
580598

581599
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
@@ -600,7 +618,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
600618

601619
if (parts.length >= 2) {
602620
const originalOsRef = parts.join('_');
603-
const cleanedParts = parts.map((p) => this.cleanName(p));
621+
const cleanedParts =
622+
parts.length >= 3
623+
? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
624+
: parts.map((p) => this.cleanName(p));
604625
const cleanedOsRef = cleanedParts.join('_');
605626

606627
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
@@ -1230,7 +1251,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
12301251
Logger.logVerbose(
12311252
`\n${this.messages.getMessage('componentMappingNotFound', ['OmniScript', originalOsRef])}`
12321253
);
1233-
component.property.flyoutOmniScript.osName = parts.map((p) => this.cleanName(p)).join('/');
1254+
component.property.flyoutOmniScript.osName =
1255+
parts.length >= 3
1256+
? `${this.cleanName(parts[0])}/${this.cleanName(parts[1])}/${parts[2]}`
1257+
: parts.map((p) => this.cleanName(p)).join('/');
12341258
}
12351259
}
12361260
}
@@ -1269,7 +1293,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
12691293
Logger.logVerbose(
12701294
`\n${this.messages.getMessage('componentMappingNotFound', ['OmniScript', fullOmniScriptName])}`
12711295
);
1272-
omniType.Name = parts.map((p) => this.cleanName(p)).join('/');
1296+
omniType.Name =
1297+
parts.length >= 3
1298+
? `${this.cleanName(parts[0])}/${this.cleanName(parts[1])}/${parts[2]}`
1299+
: parts.map((p) => this.cleanName(p)).join('/');
12731300
}
12741301
} else {
12751302
// Fallback for unexpected format
@@ -1299,7 +1326,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
12991326
} else {
13001327
// No registry mapping - use original fallback approach
13011328
Logger.logVerbose(this.messages.getMessage('componentMappingNotFound', ['OmniScript', fullOmniScriptName]));
1302-
stateAction[fieldName] = parts.map((p) => this.cleanName(p)).join('/');
1329+
stateAction[fieldName] =
1330+
parts.length >= 3
1331+
? `${this.cleanName(parts[0])}/${this.cleanName(parts[1])}/${parts[2]}`
1332+
: parts.map((p) => this.cleanName(p)).join('/');
13031333
}
13041334
} else {
13051335
// Fallback for unexpected format

0 commit comments

Comments
 (0)