Skip to content

Commit

Permalink
LPS-134833 Simpily no need to usee authority to tell if it's relative
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurchan35 authored and brianchandotcom committed Aug 4, 2021
1 parent 8aa3fd7 commit 6389885
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions portal-impl/src/com/liferay/portal/util/PortalImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -948,28 +948,16 @@ public String escapeRedirect(String url) {
return null;
}

String authority = uri.getAuthority();
String path = uri.getPath();

String protocol = uri.getScheme();

// When authority is empty, only return when it's a valid relative URL

if (authority == null) {
if (uri.getPath() == null) {
return null;
}

// Specs allow URL of protocol followed by path, but we do not

if (protocol != null) {
return null;
}

// The URL is a relative path
// Return when it's a relative URL

if (Validator.isNotNull(path) && url.startsWith(path)) {
return url;
}

String protocol = uri.getScheme();

// Specs regard URL starting with double slashes as valid, but we do not

if (protocol == null) {
Expand Down

0 comments on commit 6389885

Please sign in to comment.