Index: sdk/lib/vmservice/devfs.dart |
diff --git a/sdk/lib/vmservice/devfs.dart b/sdk/lib/vmservice/devfs.dart |
index 35af74822d7b27accf8b66c60175c7cdcab29576..47355127ed5367aca4da4bc1d5a47103e7c28543 100644 |
--- a/sdk/lib/vmservice/devfs.dart |
+++ b/sdk/lib/vmservice/devfs.dart |
@@ -37,10 +37,18 @@ class _FileSystem { |
} |
Uri pathUri; |
try { |
- pathUri = Uri.parse(path); |
+ pathUri = new Uri.file(path); |
} on FormatException catch(e) { |
return null; |
} |
+ |
+ try { |
+ // Make sure that this pathUri can be converted to a file path. |
+ pathUri.toFilePath(); |
+ } on UnsupportedError catch (e) { |
+ return null; |
+ } |
+ |
Uri resolvedUri = uri.resolveUri(pathUri); |
if (!resolvedUri.toString().startsWith(uri.toString())) { |
// Resolved uri must be within the filesystem's base uri. |
@@ -313,6 +321,10 @@ class DevFS { |
return _encodeFileSystemDoesNotExistError(message, fsName); |
} |
var fileList = await listFiles(fs.uri); |
+ // Remove any url-encoding in the filenames. |
+ for (int i = 0; i < fileList.length; i++) { |
+ fileList[i]['name'] = Uri.decodeFull(fileList[i]['name']); |
+ } |
var result = { 'type': 'FSFileList', 'files': fileList }; |
return encodeResult(message, result); |
} |