mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
(refs #483)Fix link in markdown
This commit is contained in:
@@ -102,8 +102,15 @@ class GitBucketHtmlSerializer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def fixUrl(url: String): String = {
|
private def fixUrl(url: String): String = {
|
||||||
if(!enableWikiLink || url.startsWith("http://") || url.startsWith("https://") || url.startsWith("#")){
|
if(!enableWikiLink){
|
||||||
url
|
if(url.startsWith("http://") || url.startsWith("https://") || url.startsWith("#") || url.startsWith("/") ||
|
||||||
|
context.currentPath.contains("/blob/")){
|
||||||
|
url
|
||||||
|
} else {
|
||||||
|
val paths = context.currentPath.split("/")
|
||||||
|
val branch = if(paths.length > 3) paths.last else repository.repository.defaultBranch
|
||||||
|
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + branch + "/" + url
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/_blob/" + url
|
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/_blob/" + url
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user