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

Side by Side Diff: sdk/lib/core/uri.dart

Issue 2158933003: Fix for uri replace whene uri has fragment. Was adding a second '#'. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/corelib/uri_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.core; 5 part of dart.core;
6 6
7 // Frequently used character codes. 7 // Frequently used character codes.
8 const int _SPACE = 0x20; 8 const int _SPACE = 0x20;
9 const int _PERCENT = 0x25; 9 const int _PERCENT = 0x25;
10 const int _PLUS = 0x2B; 10 const int _PLUS = 0x2B;
(...skipping 4189 matching lines...) Expand 10 before | Expand all | Expand 10 after
4200 if (query != null || queryParameters != null) { 4200 if (query != null || queryParameters != null) {
4201 query = _Uri._makeQuery( 4201 query = _Uri._makeQuery(
4202 query, 0, _stringOrNullLength(query), queryParameters); 4202 query, 0, _stringOrNullLength(query), queryParameters);
4203 } else if (_queryStart < _fragmentStart) { 4203 } else if (_queryStart < _fragmentStart) {
4204 query = _uri.substring(_queryStart, _fragmentStart); 4204 query = _uri.substring(_queryStart, _fragmentStart);
4205 } 4205 }
4206 4206
4207 if (fragment != null) { 4207 if (fragment != null) {
4208 fragment = _Uri._makeFragment(fragment, 0, fragment.length); 4208 fragment = _Uri._makeFragment(fragment, 0, fragment.length);
4209 } else if (_fragmentStart < _uri.length) { 4209 } else if (_fragmentStart < _uri.length) {
4210 fragment = _uri.substring(_fragmentStart); 4210 fragment = _uri.substring(_fragmentStart + 1);
4211 } 4211 }
4212 4212
4213 return new _Uri._internal( 4213 return new _Uri._internal(
4214 scheme, userInfo, host, port, path, query, fragment); 4214 scheme, userInfo, host, port, path, query, fragment);
4215 } 4215 }
4216 4216
4217 Uri resolve(String reference) { 4217 Uri resolve(String reference) {
4218 return resolveUri(Uri.parse(reference)); 4218 return resolveUri(Uri.parse(reference));
4219 } 4219 }
4220 4220
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
4456 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3; 4456 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3;
4457 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/; 4457 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/;
4458 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/; 4458 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/;
4459 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/; 4459 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/;
4460 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/; 4460 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/;
4461 return delta; 4461 return delta;
4462 } 4462 }
4463 4463
4464 /// Helper function returning the length of a string, or `0` for `null`. 4464 /// Helper function returning the length of a string, or `0` for `null`.
4465 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length; 4465 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length;
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/uri_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698