|
3 | 3 | import { join } from "path/mod.ts"; |
4 | 4 | import { Input, Secret } from "cliffy/prompt/mod.ts"; |
5 | 5 | import { RenderFlags } from "../../command/render/types.ts"; |
| 6 | +import { pathWithForwardSlashes } from "../../core/path.ts"; |
6 | 7 |
|
7 | 8 | import { |
8 | 9 | readAccessTokens, |
@@ -244,7 +245,7 @@ async function publish( |
244 | 245 |
|
245 | 246 | const space = await client.getSpace(parent.space); |
246 | 247 |
|
247 | | - trace("publish", { parent, server, space }); |
| 248 | + trace("publish", { parent, server, id: space.id, key: space.key }); |
248 | 249 |
|
249 | 250 | const uniquifyTitle = async (title: string, idToIgnore: string = "") => { |
250 | 251 | const titleAlreadyExistsInSpace: boolean = await client.isTitleInSpace( |
@@ -483,10 +484,12 @@ async function publish( |
483 | 484 | body: ContentBody, |
484 | 485 | titleToCreate: string = title, |
485 | 486 | createParent: ConfluenceParent = parent, |
486 | | - fileName: string = "" |
| 487 | + fileNameParam: string = "" |
487 | 488 | ): Promise<Content> => { |
488 | 489 | const createTitle = await uniquifyTitle(titleToCreate); |
489 | 490 |
|
| 491 | + const fileName = pathWithForwardSlashes(fileNameParam); |
| 492 | + |
490 | 493 | const attachmentsToUpload: string[] = findAttachments( |
491 | 494 | body.storage.value, |
492 | 495 | publishFiles.files, |
@@ -578,10 +581,9 @@ async function publish( |
578 | 581 | parentId, |
579 | 582 | publishFiles, |
580 | 583 | metadataByInput, |
| 584 | + existingSite, |
581 | 585 | }); |
582 | 586 |
|
583 | | - trace("existingSite", existingSite); |
584 | | - |
585 | 587 | const filteredFiles: string[] = filterFilesForUpdate(publishFiles.files); |
586 | 588 |
|
587 | 589 | trace("filteredFiles", filteredFiles); |
@@ -654,16 +656,18 @@ async function publish( |
654 | 656 | parent: ancestorId ?? siteParent.parent, |
655 | 657 | }; |
656 | 658 |
|
| 659 | + const universalPath = pathWithForwardSlashes(change.fileName ?? ""); |
| 660 | + |
657 | 661 | const result = await createContent( |
658 | 662 | publishFiles, |
659 | 663 | change.body, |
660 | 664 | change.title ?? "", |
661 | 665 | ancestorParent, |
662 | | - change.fileName |
| 666 | + universalPath |
663 | 667 | ); |
664 | 668 |
|
665 | | - if (change.fileName) { |
666 | | - pathsToId[change.fileName] = result.id ?? ""; |
| 669 | + if (universalPath) { |
| 670 | + pathsToId[universalPath] = result.id ?? ""; |
667 | 671 | } |
668 | 672 |
|
669 | 673 | const contentPropertyResult: Content = |
|
0 commit comments