mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-07 15:17:28 +02:00
Generate submodule link only when url starts with http:// or https://
This commit is contained in:
@@ -145,21 +145,35 @@
|
||||
</td>
|
||||
<td class="ellipsis-cell" style="width: 20%; min-width: 160px;">
|
||||
@if(file.isDirectory){
|
||||
@if(file.linkUrl.isDefined){
|
||||
<a href="@file.linkUrl">
|
||||
<span class="simplified-path">@file.name.split("/").toList.init match {
|
||||
case Nil => {}
|
||||
case list => {@list.mkString("", "/", "/")}
|
||||
}</span>@file.name.split("/").toList.last
|
||||
</a>
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/tree@{(branch :: pathList).map(helpers.encodeRefName).mkString("/", "/", "/")}@{helpers.encodeRefName(file.name)}">
|
||||
<span class="simplified-path">@file.name.split("/").toList.init match {
|
||||
case Nil => {}
|
||||
case list => {@list.mkString("", "/", "/")}
|
||||
}</span>@file.name.split("/").toList.last
|
||||
</a>
|
||||
}
|
||||
@{file.linkUrl match {
|
||||
case Some(linkUrl) if linkUrl.startsWith("http://") || linkUrl.startsWith("https://") => {
|
||||
<a href={linkUrl}>
|
||||
<span class="simplified-path">{file.name.split("/").toList.init match {
|
||||
case Nil => ""
|
||||
case list => list.mkString("", "/", "/")
|
||||
}}</span>
|
||||
{file.name.split("/").toList.last}
|
||||
</a>
|
||||
}
|
||||
case Some(_) => {
|
||||
<span>
|
||||
<span class="simplified-path">{file.name.split("/").toList.init match {
|
||||
case Nil => ""
|
||||
case list => list.mkString("", "/", "/")
|
||||
}}</span>
|
||||
{file.name.split("/").toList.last}
|
||||
</span>
|
||||
}
|
||||
case None => {
|
||||
<a href={helpers.url(repository) + "/tree" + (branch :: pathList).map(helpers.encodeRefName).mkString("/", "/", "/") + helpers.encodeRefName(file.name)}>
|
||||
<span class="simplified-path">{file.name.split("/").toList.init match {
|
||||
case Nil => ""
|
||||
case list => list.mkString("", "/", "/")
|
||||
}}</span>
|
||||
{file.name.split("/").toList.last}
|
||||
</a>
|
||||
}
|
||||
}}
|
||||
} else {
|
||||
<a href="@helpers.url(repository)/blob@{(branch :: pathList).map(helpers.encodeRefName).mkString("/", "/", "/")}@{helpers.encodeRefName(file.name)}">@file.name</a>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user