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

Unified Diff: pkg/http_server/lib/src/virtual_directory.dart

Issue 125003002: Fix Directory path in VirtualDirectory, so it always ends with a platform-specific seperator. That'… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | pkg/http_server/test/virtual_directory_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http_server/lib/src/virtual_directory.dart
diff --git a/pkg/http_server/lib/src/virtual_directory.dart b/pkg/http_server/lib/src/virtual_directory.dart
index 88a9d50cc8fcc46b9f29282e1d723e0c28192801..7665a71e7cb40dec5f1b6793a54a273e9af19c97 100644
--- a/pkg/http_server/lib/src/virtual_directory.dart
+++ b/pkg/http_server/lib/src/virtual_directory.dart
@@ -97,7 +97,11 @@ class VirtualDirectory {
path = normalize(path);
// If we jail to root, the relative path can never go up.
if (jailRoot && split(path).first == "..") return new Future.value(null);
- String fullPath() => join(root, path);
+ String fullPath({bool endSlash: false}) {
+ var p = join(root, path);
+ if (endSlash && path != ".") p = "$p$separator";
+ return p;
+ }
return FileSystemEntity.type(fullPath(), followLinks: false)
.then((type) {
switch (type) {
@@ -110,7 +114,7 @@ class VirtualDirectory {
case FileSystemEntityType.DIRECTORY:
if (segments.current == null) {
if (allowDirectoryListing) {
- return new Directory(fullPath());
+ return new Directory(fullPath(endSlash: true));
}
} else {
if (_invalidPathRegExp.hasMatch(segments.current)) break;
« no previous file with comments | « no previous file | pkg/http_server/test/virtual_directory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698