@@ -294,7 +294,7 @@ async function publish(
294294 let fileBuffer : Uint8Array ;
295295 let fileHash : string ;
296296 const path = join ( baseDirectory , attachmentPath ) ;
297-
297+
298298 trace (
299299 "uploadAttachment" ,
300300 {
@@ -317,6 +317,7 @@ async function publish(
317317 }
318318
319319 const fileName = pathWithForwardSlashes ( attachmentPath ) ;
320+
320321
321322 const existingDuplicateAttachment = existingAttachments . find (
322323 ( attachment : AttachmentSummary ) => {
@@ -342,6 +343,8 @@ async function publish(
342343 return attachment ;
343344 } ;
344345
346+
347+
345348 return attachmentsToUpload . map ( uploadAttachment ) ;
346349 } ;
347350
@@ -350,7 +353,8 @@ async function publish(
350353 id : string ,
351354 body : ContentBody ,
352355 titleToUpdate : string = title ,
353- fileName : string = ""
356+ fileName : string = "" ,
357+ uploadFileAttachments : boolean = true
354358 ) : Promise < Content > => {
355359 const previousPage = await client . getContent ( id ) ;
356360
@@ -381,7 +385,7 @@ async function publish(
381385
382386 const updatedContent : Content = await client . updateContent ( toUpdate ) ;
383387
384- if ( toUpdate . id ) {
388+ if ( toUpdate . id && uploadFileAttachments ) {
385389 const existingAttachments : AttachmentSummary [ ] =
386390 await client . getAttachments ( toUpdate . id ) ;
387391
@@ -645,7 +649,10 @@ async function publish(
645649
646650 let pathsToId : Record < string , string > = { } ; // build from existing site
647651
648- const doChange = async ( change : ConfluenceSpaceChange ) => {
652+ const doChange = async (
653+ change : ConfluenceSpaceChange ,
654+ uploadFileAttachments : boolean = true
655+ ) => {
649656 if ( isContentCreate ( change ) ) {
650657 let ancestorId =
651658 ( change ?. ancestors && change ?. ancestors [ 0 ] ?. id ) ?? null ;
@@ -687,7 +694,8 @@ async function publish(
687694 update . id ?? "" ,
688695 update . body ,
689696 update . title ?? "" ,
690- update . fileName ?? ""
697+ update . fileName ?? "" ,
698+ uploadFileAttachments
691699 ) ;
692700 } else if ( isContentDelete ( change ) ) {
693701 if ( DELETE_DISABLED ) {
@@ -703,6 +711,7 @@ async function publish(
703711 }
704712 } ;
705713
714+
706715 for ( let currentChange of changeList ) {
707716 await doChange ( currentChange ) ;
708717 }
@@ -722,9 +731,9 @@ async function publish(
722731 server ,
723732 parent
724733 ) ;
725-
734+
726735 for ( let currentChange of linkUpdateChanges ) {
727- await doChange ( currentChange ) ;
736+ await doChange ( currentChange , false ) ;
728737 }
729738 }
730739
0 commit comments