summaryrefslogtreecommitdiffstats
path: root/client/src/com/vaadin
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2013-04-18 16:45:02 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-19 13:02:20 +0000
commit747a88c642eb08992467ce88862fb93463d6ea20 (patch)
tree08c939e39210fa390d172fdaa9fbc09937ed2917 /client/src/com/vaadin
parent0a2b6b5127f97bededd4b84926d656b9dd4a3032 (diff)
downloadvaadin-framework-747a88c642eb08992467ce88862fb93463d6ea20.tar.gz
vaadin-framework-747a88c642eb08992467ce88862fb93463d6ea20.zip
Prevent double encoding problems when URI fragment contains special characters (#10769)
Change-Id: I9043a1f84140b441ab4b3e86eadb708359a29155
Diffstat (limited to 'client/src/com/vaadin')
-rw-r--r--client/src/com/vaadin/client/ui/VUI.java8
-rw-r--r--client/src/com/vaadin/client/ui/ui/UIConnector.java6
2 files changed, 11 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/ui/VUI.java b/client/src/com/vaadin/client/ui/VUI.java
index b07593896f..9a73aa5f8f 100644
--- a/client/src/com/vaadin/client/ui/VUI.java
+++ b/client/src/com/vaadin/client/ui/VUI.java
@@ -133,10 +133,16 @@ public class VUI extends SimplePanel implements ResizeHandler,
// Send the location to the server if the fragment has changed
// and flush active connectors in UI.
if (!newFragment.equals(currentFragment) && connection != null) {
+
+ // Ensure the fragment is properly encoded in all browsers
+ // (#10769)
+ String location = Window.Location.createUrlBuilder()
+ .buildString();
+
currentFragment = newFragment;
connection.flushActiveConnector();
connection.updateVariable(id, UIConstants.LOCATION_VARIABLE,
- Window.Location.getHref(), true);
+ location, true);
}
}
};
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index ac441fc625..593aa0d793 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -28,6 +28,7 @@ import com.google.gwt.event.dom.client.ScrollEvent;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
+import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
@@ -303,8 +304,9 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
.getStringAttribute(UIConstants.LOCATION_VARIABLE);
int fragmentIndex = location.indexOf('#');
if (fragmentIndex >= 0) {
- getWidget().currentFragment = location
- .substring(fragmentIndex + 1);
+ // Decode fragment to avoid double encoding (#10769)
+ getWidget().currentFragment = URL.decodePathSegment(location
+ .substring(fragmentIndex + 1));
}
if (!getWidget().currentFragment.equals(History.getToken())) {
History.newItem(getWidget().currentFragment, true);