Skip to content

Commit c83eec2

Browse files
author
Al Manning
committed
Links aren't resolved in index.qmd on Confluence #4652
1 parent 8e428b3 commit c83eec2

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/publish/confluence/confluence-helper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,14 @@ export const updateLinks = (
688688
}
689689
}
690690

691+
if (!documentFileName.endsWith(".xml")) {
692+
//this is a flattened index in a folder with contents
693+
const siteFilePathParent = `${documentFileName}/${linkFullFileName}`;
694+
if (fileMetadataTable[siteFilePathParent]) {
695+
siteFilePath = siteFilePathParent;
696+
}
697+
}
698+
691699
const sitePage: SitePage | null = fileMetadataTable[siteFilePath] ?? null;
692700

693701
if (sitePage) {

tests/unit/confluence.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ import {
6161
Space,
6262
} from "../../src/publish/confluence/api/types.ts";
6363

64-
const RUN_ALL_TESTS = false;
65-
const FOCUS_TEST = true;
64+
const RUN_ALL_TESTS = true;
65+
const FOCUS_TEST = false;
6666
const HIDE_NOISE = true;
6767

6868
const xtest = (
@@ -3758,7 +3758,7 @@ const runUpdateLinks = () => {
37583758
fileName: "release-planning.xml",
37593759
};
37603760

3761-
const UPDATE_LINK_FROM_INDEX: ContentUpdate = {
3761+
const UPDATE_SELF_LINK_FROM_INDEX: ContentUpdate = {
37623762
contentChangeType: ContentChangeType.update,
37633763
id: "fake-folder-id",
37643764
version: null,
@@ -3768,11 +3768,11 @@ const runUpdateLinks = () => {
37683768
ancestors: [{ id: "19759105" }],
37693769
body: {
37703770
storage: {
3771-
value: "<a href='triage.qmd'>triage</a>",
3771+
value: "<a href='index.qmd'>self</a>",
37723772
representation: "storage",
37733773
},
37743774
},
3775-
fileName: "release-planning.xml",
3775+
fileName: "folder",
37763776
};
37773777

37783778
const UPDATE_LINKS_SPECIAL_CHAR: ContentUpdate = {
@@ -3951,13 +3951,13 @@ const runUpdateLinks = () => {
39513951
});
39523952

39533953
test(suiteLabel("one_update_link_from_index"), async () => {
3954-
const changes: ConfluenceSpaceChange[] = [UPDATE_LINK_FROM_INDEX];
3954+
const changes: ConfluenceSpaceChange[] = [UPDATE_SELF_LINK_FROM_INDEX];
39553955
const rootURL = "fake-server/wiki/spaces/QUARTOCONF/pages";
39563956
const expectedUpdate: ContentUpdate = {
3957-
...UPDATE_LINK_FROM_INDEX,
3957+
...UPDATE_SELF_LINK_FROM_INDEX,
39583958
body: {
39593959
storage: {
3960-
value: `<a href=\'fake-server/wiki/spaces/QUARTOCONF/pages/19890180'>triage</a>`,
3960+
value: `<a href=\'fake-server/wiki/spaces/QUARTOCONF/pages/fake-index-id'>self</a>`,
39613961
representation: "storage",
39623962
},
39633963
},

0 commit comments

Comments
 (0)