mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-05 16:15:54 +00:00
[FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive.
This commit is contained in:
1 parent
7037c23d95
commit
bcc8614856
3 files changed
+29
-16
No files matched your search
@@ -1014,20 +1014,15 @@ public class Functions {
|
||||
|
||||
Item i=p;
|
||||
String url = "";
|
||||
Collection<TopLevelItem> viewItems;
|
||||
if (view != null) {
|
||||
viewItems = view.getItems();
|
||||
} else {
|
||||
viewItems = Collections.emptyList();
|
||||
}
|
||||
while(true) {
|
||||
ItemGroup ig = i.getParent();
|
||||
url = i.getShortUrl()+url;
|
||||
|
||||
if(ig== Jenkins.getInstance() || (view != null && ig == view.getOwnerItemGroup())) {
|
||||
assert i instanceof TopLevelItem;
|
||||
if(viewItems.contains((TopLevelItem)i)) {
|
||||
// if p and the current page belongs to the same view, then return a relative path
|
||||
if (view != null) {
|
||||
// assume p and the current page belong to the same view, so return a relative path
|
||||
// (even if they did not, View.getItem does not by default verify ownership)
|
||||
return normalizeURI(ancestors.get(view)+'/'+url);
|
||||
} else {
|
||||
// otherwise return a path from the root Hudson
|
||||
|
||||
Reference in new issue
Block a user