Handle absolute URLs in the TopLevel menu.
Absolute URLs were being treated as relative URLs. This addresses the problem by checking if the URL starts with 'https?://' for both http and https URLs. Bug: Issue 2551 Change-Id: I3ee1e9092bce1edffc0e740495936539d2089466
This commit is contained in:
parent
1e929e113f
commit
9e6945adf6
@ -889,11 +889,18 @@ public class Gerrit implements EntryPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addExtensionLink(LinkMenuBar m, TopMenuItem item) {
|
private static void addExtensionLink(LinkMenuBar m, TopMenuItem item) {
|
||||||
Anchor atag = anchor(item.getName(), selfRedirect(item.getUrl()));
|
Anchor atag = anchor(item.getName(), isAbsolute(item.getUrl())
|
||||||
|
? item.getUrl()
|
||||||
|
: selfRedirect(item.getUrl()));
|
||||||
|
|
||||||
atag.setTarget(item.getTarget());
|
atag.setTarget(item.getTarget());
|
||||||
if (item.getId() != null) {
|
if (item.getId() != null) {
|
||||||
atag.getElement().setAttribute("id", item.getId());
|
atag.getElement().setAttribute("id", item.getId());
|
||||||
}
|
}
|
||||||
m.add(atag);
|
m.add(atag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isAbsolute(String url) {
|
||||||
|
return url.matches("^https?://.*");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user