@@ -503,9 +503,6 @@ export const updateLinks = (
503503 server : string ,
504504 parent : ConfluenceParent
505505) : ConfluenceSpaceChange [ ] => {
506- console . log ( "updateLinks" ) ;
507- console . log ( "fileMetadataTable" , fileMetadataTable ) ;
508-
509506 const root = `${ server } ` ;
510507 const url = `${ ensureTrailingSlash ( server ) } wiki/spaces/${
511508 parent . space
@@ -514,12 +511,7 @@ export const updateLinks = (
514511 const changeMapper = (
515512 changeToProcess : ConfluenceSpaceChange
516513 ) : ConfluenceSpaceChange => {
517- console . log ( "changeToProcess" , changeToProcess ) ;
518-
519514 const replacer = ( match : string ) : string => {
520- console . log ( "replacer" ) ;
521- console . log ( "match" , match ) ;
522-
523515 let documentFileName = "" ;
524516 if (
525517 isContentUpdate ( changeToProcess ) ||
@@ -529,26 +521,23 @@ export const updateLinks = (
529521 }
530522
531523 const docFileNamePathList = documentFileName . split ( "/" ) ;
532- console . log ( "docFileNamePathList" , docFileNamePathList ) ;
533524
534525 let updated : string = match ;
535526 const linkFileNameMatch = FILE_FINDER . exec ( match ) ;
536- console . log ( "linkFileNameMatch" , linkFileNameMatch ) ;
527+
537528 const linkFileName = linkFileNameMatch ? linkFileNameMatch [ 0 ] ?? "" : "" ;
538- console . log ( "fileName" , linkFileName ) ;
529+
539530 const fileNamePathList = linkFileName . split ( "/" ) ;
540- console . log ( "fileNamePathList" , fileNamePathList ) ;
541531
542532 const linkFullFileName = `${ linkFileName } .qmd` ;
543- console . log ( "linkFullFileName" , linkFullFileName ) ;
544533
545534 let siteFilePath = linkFullFileName ;
546535 const isAbsolute = siteFilePath . startsWith ( "/" ) ;
547536 if ( ! isAbsolute && docFileNamePathList . length > 1 ) {
548537 const relativePath = docFileNamePathList
549538 . slice ( 0 , docFileNamePathList . length - 1 )
550539 . join ( "/" ) ;
551- console . log ( "relativePath" , relativePath ) ;
540+
552541 if ( siteFilePath . startsWith ( "./" ) ) {
553542 siteFilePath = siteFilePath . replace ( "./" , `${ relativePath } /` ) ;
554543 } else {
@@ -560,36 +549,31 @@ export const updateLinks = (
560549 siteFilePath = siteFilePath . slice ( 1 ) ; //remove '/'
561550 }
562551
563- console . log ( "siteFilePath" , siteFilePath ) ;
564-
565552 const sitePage : SitePage | null = fileMetadataTable [ siteFilePath ] ?? null ;
566553
567- console . log ( "sitePage" , sitePage ) ;
568-
569554 if ( sitePage ) {
570555 updated = match . replace ( 'href="' , `href="${ url } ` ) ;
571556 const pagePath : string = `${ url } ${ sitePage . id } /${ encodeURI (
572557 sitePage . title ?? ""
573558 ) } `;
574559
575560 updated = updated . replace ( linkFullFileName , pagePath ) ;
576- console . log ( "updated" , updated ) ;
577561 } else {
578- console . warn ( "no site page found" ) ;
562+ console . warn ( `Link not found for ${ siteFilePath } ` ) ;
579563 }
580564
581565 return updated ;
582566 } ;
583567
584568 if ( isContentUpdate ( changeToProcess ) || isContentCreate ( changeToProcess ) ) {
585569 const valueToProcess = changeToProcess ?. body ?. storage ?. value ;
586- console . log ( "valueToProcess" , valueToProcess ) ;
570+
587571 if ( valueToProcess ) {
588572 const replacedLinks : string = valueToProcess . replaceAll (
589573 LINK_FINDER ,
590574 replacer
591575 ) ;
592- console . log ( "replacedLinks" , replacedLinks ) ;
576+
593577 changeToProcess . body . storage . value = replacedLinks ;
594578 }
595579 }
0 commit comments