File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,17 @@ export class ConfluenceClient {
5959 return this . get < WrappedResult < ContentSummary > > ( url ) ;
6060 }
6161
62- public async isTitleInSpace ( title : string , space : Space ) : Promise < boolean > {
62+ public async isTitleInSpace (
63+ title : string ,
64+ space : Space ,
65+ idToIgnore : string = ""
66+ ) : Promise < boolean > {
6367 const result = await this . fetchMatchingTitlePages ( title , space ) ;
68+
69+ if ( result . length === 1 && result [ 0 ] . id === idToIgnore ) {
70+ return false ;
71+ }
72+
6473 return result . length > 0 ;
6574 }
6675
Original file line number Diff line number Diff line change @@ -247,10 +247,11 @@ async function publish(
247247
248248 trace ( "publish" , { parent, server, space } ) ;
249249
250- const uniquifyTitle = async ( title : string ) => {
250+ const uniquifyTitle = async ( title : string , idToIgnore : string = "" ) => {
251251 const titleAlreadyExistsInSpace : boolean = await client . isTitleInSpace (
252252 title ,
253- space
253+ space ,
254+ idToIgnore
254255 ) ;
255256
256257 const uuid = globalThis . crypto . randomUUID ( ) ;
@@ -360,7 +361,7 @@ async function publish(
360361 publishFiles . files
361362 ) ;
362363
363- const uniqueTitle = await uniquifyTitle ( titleToUpdate ) ;
364+ const uniqueTitle = await uniquifyTitle ( titleToUpdate , id ) ;
364365
365366 trace ( "attachmentsToUpload" , attachmentsToUpload , LogPrefix . ATTACHMENT ) ;
366367
You can’t perform that action at this time.
0 commit comments