Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1213)

Unified Diff: sdk/lib/core/uri.dart

Issue 15854003: Fix some bugs in the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/corelib/uri_query_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/uri.dart
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index c8277e7fc6b4b035ad7624e195049d0817a80740..d3ae2e16868e18caa41ab88efef408498b653c92 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -183,7 +183,7 @@ class Uri {
return query.split("&").fold({}, (map, element) {
int index = element.indexOf("=");
if (index == -1) {
- if (!element.isEmpty) map[element] = "";
+ if (!element.isEmpty) map[decodeQueryComponent(element)] = "";
} else if (index != 0) {
var key = element.substring(0, index);
var value = element.substring(index + 1);
@@ -310,17 +310,18 @@ class Uri {
int length = component.length;
int index = 0;
int prevIndex = 0;
- while (index < length) {
- // Copy a part of the component string to the result.
- fillResult() {
- if (result == null) {
- assert(prevIndex == 0);
- result = new StringBuffer(component.substring(prevIndex, index));
- } else {
- result.write(component.substring(prevIndex, index));
- }
+ // Copy a part of the component string to the result.
+ fillResult() {
Lasse Reichstein Nielsen 2013/06/03 07:56:47 void return type. Makes it more obvious that this
Søren Gjesse 2013/06/03 09:35:41 Done.
+ if (result == null) {
+ assert(prevIndex == 0);
+ result = new StringBuffer(component.substring(prevIndex, index));
+ } else {
+ result.write(component.substring(prevIndex, index));
}
+ }
+
+ while (index < length) {
// Normalize percent encoding to uppercase and don't encode
// unreserved characters.
@@ -353,6 +354,7 @@ class Uri {
index++;
}
}
+ if (result != null && prevIndex != index) fillResult();
assert(index == length);
if (result == null) return component;
« no previous file with comments | « no previous file | tests/corelib/uri_query_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698