mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 21:30:39 +00:00
fix code bug (#6071)
This commit is contained in:
@@ -268,7 +268,11 @@ class Wiki extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onLinkClick = (link) => {
|
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)) {
|
if (Utils.isWikiInternalMarkdownLink(url, slug)) {
|
||||||
let path = Utils.getPathFromWikiInternalMarkdownLink(url, slug);
|
let path = Utils.getPathFromWikiInternalMarkdownLink(url, slug);
|
||||||
this.showFile(path);
|
this.showFile(path);
|
||||||
|
@@ -1626,4 +1626,9 @@ export const Utils = {
|
|||||||
history.replaceState(null, '', origin + pathname + newSearch);
|
history.replaceState(null, '', origin + pathname + newSearch);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isRelativePath(url) {
|
||||||
|
let RgExp = new RegExp('^(?:[a-z]+:)?//', 'i');
|
||||||
|
return !RgExp.test(url);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user