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

Unified Diff: sdk/lib/vmservice/devfs.dart

Issue 2208223002: Allow weird characters (like ?) to appear in devfs filenames. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 | « runtime/observatory/tests/service/dev_fs_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « runtime/observatory/tests/service/dev_fs_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698