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

Unified Diff: lib/src/internal_style.dart

Issue 1225373003: Fix path.toUri for relative paths. (Closed) Base URL: git@github.com:dart-lang/path@master
Patch Set: merge Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/internal_style.dart
diff --git a/lib/src/internal_style.dart b/lib/src/internal_style.dart
index db2d3462d24afc66bda6ab3209e6a123efe0e86c..549f95ba94b0b79cc4c6cd59b597bd7ba72529a9 100644
--- a/lib/src/internal_style.dart
+++ b/lib/src/internal_style.dart
@@ -57,8 +57,14 @@ abstract class InternalStyle extends Style {
String pathFromUri(Uri uri);
/// Returns the URI that represents the relative path made of [parts].
- Uri relativePathToUri(String path) =>
- new Uri(pathSegments: context.split(path));
+ Uri relativePathToUri(String path) {
+ var segments = context.split(path);
+
+ // Ensure that a trailing slash in the path produces a trailing slash in the
+ // URL.
+ if (isSeparator(path.codeUnitAt(path.length - 1))) segments.add('');
+ return new Uri(pathSegments: segments);
+ }
/// Returns the URI that represents [path], which is assumed to be absolute.
Uri absolutePathToUri(String path);
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698