Skip to content

Commit c15d020

Browse files
author
Al Manning
committed
fix issue with over-uniquification of updated docs
1 parent 8713dce commit c15d020

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/publish/confluence/api/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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

src/publish/confluence/confluence.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)