You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by as...@apache.org on 2016/12/22 16:58:13 UTC
portals-pluto git commit: PLUTO-651 PortalURLParserImpl.java
incorrectly encodes/decodes forward slash characters
Repository: portals-pluto
Updated Branches:
refs/heads/master 989892729 -> 09334bcd5
PLUTO-651 PortalURLParserImpl.java incorrectly encodes/decodes forward slash characters
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/09334bcd
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/09334bcd
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/09334bcd
Branch: refs/heads/master
Commit: 09334bcd5d9ac2e6ad44acbd266c11d3eefe6eaf
Parents: 9898927
Author: Neil Griffin <ne...@gmail.com>
Authored: Thu Dec 22 11:57:54 2016 -0500
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Dec 22 11:57:54 2016 -0500
----------------------------------------------------------------------
.../pluto/driver/url/impl/PortalURLParserImpl.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/09334bcd/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
index be0b434..d287ec7 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
@@ -66,7 +66,12 @@ public class PortalURLParserImpl implements PortalURLParser {
private static final String PUBLIC_RENDER_PARAM = "sp";
private static final String WINDOW_STATE = "ws";
private static final String PORTLET_MODE = "pm";
-
+
+ //This is a list of characters that need to be encoded to be protected
+ private static final String[][] ENCODINGS = new String[][] {
+ new String[] { "/", "0x3" },
+ };
+
// The delimiter & special chars for the value encoding are chosen
// from the URL reserved delimiter characters that ARE ENCODED by the URLEncoder
// so that they will not appear encoded parameter names or values.
@@ -672,7 +677,10 @@ public class PortalURLParserImpl implements PortalURLParser {
String out = str;
if (str != null) {
try {
- out = URLEncoder.encode(str, "UTF-8");
+ for (int i = 0; i < ENCODINGS.length; i++) {
+ out = out.replace(ENCODINGS[i][0], ENCODINGS[i][1]);
+ }
+ out = URLEncoder.encode(out, "UTF-8");
} catch(Exception e) {
LOG.warn("Error URL encoding string: " + str);
}
@@ -689,7 +697,10 @@ public class PortalURLParserImpl implements PortalURLParser {
String out = str;
if (str != null) {
try {
- out = URLDecoder.decode(str, "UTF-8");
+ for (int i = 0; i < ENCODINGS.length; i++) {
+ out = out.replace(ENCODINGS[i][1], ENCODINGS[i][0]);
+ }
+ out = URLDecoder.decode(out, "UTF-8");
} catch(Exception e) {
LOG.warn("Error URL decoding string: " + str);
}