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

Unified Diff: runtime/bin/vmservice/server.dart

Issue 2733413003: Support DevFS paths encoded as URIs (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | runtime/observatory/tests/service/dev_fs_uri_test.dart » ('j') | sdk/lib/vmservice/devfs.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/server.dart
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index c789dcf26abcb7d9b2234bf989fc210258eb71ab..3d69463a923391c83f7a7a583c24d2aee32a00ce 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -233,21 +233,33 @@ class Server {
List fsNameList;
List fsPathList;
List fsPathBase64List;
+ List fsUriBase64List;
Object fsName;
Object fsPath;
+ Object fsUri;
try {
// Extract the fs name and fs path from the request headers.
fsNameList = request.headers['dev_fs_name'];
fsName = fsNameList[0];
- fsPathList = request.headers['dev_fs_path'];
- fsPathBase64List = request.headers['dev_fs_path_b64'];
- // If the 'dev_fs_path_b64' header field was sent, use that instead.
- if ((fsPathBase64List != null) && (fsPathBase64List.length > 0)) {
- fsPath = UTF8.decode(BASE64.decode(fsPathBase64List[0]));
- } else {
- fsPath = fsPathList[0];
+ // Prefer Uri encoding first.
+ fsUriBase64List = request.headers['dev_fs_uri_b64'];
+ if ((fsUriBase64List != null) && (fsUriBase64List.length > 0)) {
+ String decodedFsUri = UTF8.decode(BASE64.decode(fsUriBase64List[0]));
+ fsUri = Uri.parse(decodedFsUri);
+ }
+
+ // Fallback to path encoding.
+ if (fsUri == null) {
+ fsPathList = request.headers['dev_fs_path'];
+ fsPathBase64List = request.headers['dev_fs_path_b64'];
+ // If the 'dev_fs_path_b64' header field was sent, use that instead.
+ if ((fsPathBase64List != null) && (fsPathBase64List.length > 0)) {
+ fsPath = UTF8.decode(BASE64.decode(fsPathBase64List[0]));
+ } else {
+ fsPath = fsPathList[0];
+ }
}
} catch (e) { /* ignore */ }
@@ -256,6 +268,7 @@ class Server {
result = await _service.devfs.handlePutStream(
fsName,
fsPath,
+ fsUri,
request.transform(GZIP.decoder));
} catch (e) { /* ignore */ }
« no previous file with comments | « no previous file | runtime/observatory/tests/service/dev_fs_uri_test.dart » ('j') | sdk/lib/vmservice/devfs.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698