diff --git a/frontend/src/pages/wiki/index.js b/frontend/src/pages/wiki/index.js index e8a85f81d1..35dd06f4b3 100644 --- a/frontend/src/pages/wiki/index.js +++ b/frontend/src/pages/wiki/index.js @@ -268,7 +268,11 @@ class Wiki extends Component { }; onLinkClick = (link) => { - const url = link; + let url = link; + if (Utils.isRelativePath(url)) { + url = window.location.href.replace('home.md', ''); + url = url + link; + } if (Utils.isWikiInternalMarkdownLink(url, slug)) { let path = Utils.getPathFromWikiInternalMarkdownLink(url, slug); this.showFile(path); diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index d095236a61..87052e01b9 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -1626,4 +1626,9 @@ export const Utils = { history.replaceState(null, '', origin + pathname + newSearch); }, + isRelativePath(url) { + let RgExp = new RegExp('^(?:[a-z]+:)?//', 'i'); + return !RgExp.test(url); + } + };