Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,12 @@ public final String getDisplayUrl() {

StaplerRequest req = Stapler.getCurrentRequest();
if (req == null) {
return u;
throw new IllegalStateException("Can't get display URL without Stapler context.");
}

Item i = req.findAncestorObject(Item.class);

StringBuilder toAppend = new StringBuilder();

toAppend.append(req.getContextPath());

if (!req.getContextPath().endsWith("/")) {
toAppend.append("/");
}

if (i == null) {
toAppend.append(u);
} else {
toAppend.append(i.getUrl());

if (!i.getUrl().endsWith("/")) {
toAppend.append("/");
}

toAppend.append(u);
}

return toAppend.toString();
return req.getContextPath() + '/' + (i == null ? "" : i.getUrl()) + u;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you manually tested both cases here?

Copy link
Member

@svanoort svanoort Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why did we remove the check for if the context path has a '/' on it? We had an actual stage view bug that resulted from a similar issue.

Edit: even if it "shouldn't" happen it's a harmless check.

}

/**
Expand Down