Skip to content

Commit 22ab865

Browse files
author
Al Manning
committed
universal file path metadata in pages
1 parent dc2b7db commit 22ab865

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/publish/confluence/api/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ export class ConfluenceClient {
128128
WrappedResult<AttachmentSummary>
129129
>(`content/${id}/child/attachment`);
130130

131-
trace("getAttachments", wrappedResult, LogPrefix.ATTACHMENT);
132-
133131
const result = wrappedResult?.results ?? [];
134132
return result;
135133
}

src/publish/confluence/confluence.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { join } from "path/mod.ts";
44
import { Input, Secret } from "cliffy/prompt/mod.ts";
55
import { RenderFlags } from "../../command/render/types.ts";
6+
import { pathWithForwardSlashes } from "../../core/path.ts";
67

78
import {
89
readAccessTokens,
@@ -244,7 +245,7 @@ async function publish(
244245

245246
const space = await client.getSpace(parent.space);
246247

247-
trace("publish", { parent, server, space });
248+
trace("publish", { parent, server, id: space.id, key: space.key });
248249

249250
const uniquifyTitle = async (title: string, idToIgnore: string = "") => {
250251
const titleAlreadyExistsInSpace: boolean = await client.isTitleInSpace(
@@ -483,10 +484,12 @@ async function publish(
483484
body: ContentBody,
484485
titleToCreate: string = title,
485486
createParent: ConfluenceParent = parent,
486-
fileName: string = ""
487+
fileNameParam: string = ""
487488
): Promise<Content> => {
488489
const createTitle = await uniquifyTitle(titleToCreate);
489490

491+
const fileName = pathWithForwardSlashes(fileNameParam);
492+
490493
const attachmentsToUpload: string[] = findAttachments(
491494
body.storage.value,
492495
publishFiles.files,
@@ -578,10 +581,9 @@ async function publish(
578581
parentId,
579582
publishFiles,
580583
metadataByInput,
584+
existingSite,
581585
});
582586

583-
trace("existingSite", existingSite);
584-
585587
const filteredFiles: string[] = filterFilesForUpdate(publishFiles.files);
586588

587589
trace("filteredFiles", filteredFiles);
@@ -654,16 +656,18 @@ async function publish(
654656
parent: ancestorId ?? siteParent.parent,
655657
};
656658

659+
const universalPath = pathWithForwardSlashes(change.fileName ?? "");
660+
657661
const result = await createContent(
658662
publishFiles,
659663
change.body,
660664
change.title ?? "",
661665
ancestorParent,
662-
change.fileName
666+
universalPath
663667
);
664668

665-
if (change.fileName) {
666-
pathsToId[change.fileName] = result.id ?? "";
669+
if (universalPath) {
670+
pathsToId[universalPath] = result.id ?? "";
667671
}
668672

669673
const contentPropertyResult: Content =

0 commit comments

Comments
 (0)