File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
utils/lwcparser/fileutils Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 138138 "flexipagesWithChanges" : " Found %s FlexiPages with changes" ,
139139 "expSitesWithChanges" : " Found %s Experience Cloud Sites with changes" ,
140140 "migratingFlexiPages" : " Migrating FlexiPages" ,
141+ "manualInterventionForFlexiPageAsDuplicateKey" : " We couldn’t process the %s %s because a duplicate key was found in storage." ,
141142 "experienceSiteMetadataConsent" : " Your consent for migrating Experience Cloud sites is %s" ,
142143 "experienceSiteConsentNotProvidedWarning" : " You’ve not provided consent and your Experience Cloud sites won’t be processed." ,
143144 "relatedObjectsToProcessAfterExpSitesRemoval" : " Objects to process after removing expsite are %s." ,
Original file line number Diff line number Diff line change @@ -133,7 +133,9 @@ export class FlexipageMigration extends BaseRelatedObjectMigration {
133133 errors . add ( error . message ) ;
134134 status = mode === 'assess' ? 'Needs manual intervention' : 'Skipped' ;
135135 } else if ( error instanceof DuplicateKeyError ) {
136- errors . add ( `${ error . componentType } ${ error . key } is duplicate` ) ;
136+ errors . add (
137+ this . messages . getMessage ( 'manualInterventionForFlexiPageAsDuplicateKey' , [ error . componentType , error . key ] )
138+ ) ;
137139 status = mode === 'assess' ? 'Needs manual intervention' : 'Skipped' ;
138140 } else {
139141 errors . add ( this . messages . getMessage ( 'errorProcessingFlexiPage' , [ file , error ] ) ) ;
@@ -192,7 +194,11 @@ export class FlexipageMigration extends BaseRelatedObjectMigration {
192194 Logger . logVerbose ( this . messages . getMessage ( 'updatedModifiedContent' , [ filePath ] ) ) ;
193195 }
194196
195- const diff = new FileDiffUtil ( ) . getXMLDiff ( fileContent , modifiedContent ) ;
197+ // Normalize trailing newlines to avoid false positives in diff
198+ // Both original and modified content are normalized to remove trailing newlines
199+ const normalizedOriginal = fileContent . replace ( / \n + $ / , '' ) ;
200+ const normalizedModified = modifiedContent . replace ( / \n + $ / , '' ) ;
201+ const diff = new FileDiffUtil ( ) . getXMLDiff ( normalizedOriginal , normalizedModified ) ;
196202 Logger . logVerbose ( this . messages . getMessage ( 'generatedDiffForFile' , [ fileName ] ) ) ;
197203
198204 return {
Original file line number Diff line number Diff line change @@ -166,15 +166,21 @@ export class FileDiffUtil {
166166 for ( const block of diff ) {
167167 if ( block . added ) {
168168 block . value . split ( '\n' ) . forEach ( ( line ) => {
169- result . push ( { old : null , new : line } ) ;
169+ if ( line . trim ( ) !== '' ) {
170+ result . push ( { old : null , new : line } ) ;
171+ }
170172 } ) ;
171173 } else if ( block . removed ) {
172174 block . value . split ( '\n' ) . forEach ( ( line ) => {
173- result . push ( { old : line , new : null } ) ;
175+ if ( line . trim ( ) !== '' ) {
176+ result . push ( { old : line , new : null } ) ;
177+ }
174178 } ) ;
175179 } else {
176180 block . value . split ( '\n' ) . forEach ( ( line ) => {
177- result . push ( { old : line , new : line } ) ;
181+ if ( line . trim ( ) !== '' ) {
182+ result . push ( { old : line , new : line } ) ;
183+ }
178184 } ) ;
179185 }
180186 }
You can’t perform that action at this time.
0 commit comments