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

Unified Diff: sdk/lib/_internal/compiler/implementation/util/uri_extras.dart

Issue 189563004: Use '--source-map' and '--out' options to support source maps from non-commandline. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
Index: sdk/lib/_internal/compiler/implementation/util/uri_extras.dart
diff --git a/sdk/lib/_internal/compiler/implementation/util/uri_extras.dart b/sdk/lib/_internal/compiler/implementation/util/uri_extras.dart
index 654341d24d91f3640773ca7e1740a0b10c986545..65a4ed2516112ac27787c9719d5cc45e73642d4c 100644
--- a/sdk/lib/_internal/compiler/implementation/util/uri_extras.dart
+++ b/sdk/lib/_internal/compiler/implementation/util/uri_extras.dart
@@ -34,8 +34,9 @@ String relativize(Uri base, Uri uri, bool isWindows) {
base.port == uri.port &&
uri.query == "" && uri.fragment == "") {
if (normalize(uri.path).startsWith(normalize(base.path))) {
- return uri.path.substring(base.path.length);
+ return uri.path.substring(base.path.lastIndexOf('/') + 1);
}
+
List<String> uriParts = uri.path.split('/');
List<String> baseParts = base.path.split('/');
int common = 0;
@@ -48,7 +49,10 @@ String relativize(Uri base, Uri uri, bool isWindows) {
// The first part will always be an empty string because the
// paths are absolute. On Windows, we must also consider drive
// letters or hostnames.
- return uri.path;
+ if (baseParts.length > common + 1) {
+ // Avoid using '..' to go to the root, unless we are already there.
+ return uri.path;
+ }
}
StringBuffer sb = new StringBuffer();
for (int i = common + 1; i < baseParts.length; i++) {

Powered by Google App Engine
This is Rietveld 408576698