1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 13:24:52 +00:00

fix code bug (#6071)

This commit is contained in:
杨顺强
2024-05-13 13:54:15 +08:00
committed by GitHub
parent 9e2bd4c3ce
commit 39aa588e2d
2 changed files with 10 additions and 1 deletions

View File

@@ -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);

View File

@@ -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);
}
};