Commit 63016c89 authored by Jason Simmons's avatar Jason Simmons Committed by Flutter GitHub Bot

[flutter_tools] Handle special characters during conversion of asset manifest...

[flutter_tools] Handle special characters during conversion of asset manifest paths into URIs (#48829)
parent aeb12144
...@@ -204,7 +204,7 @@ class FlutterManifest { ...@@ -204,7 +204,7 @@ class FlutterManifest {
} }
final String stringAsset = asset as String; final String stringAsset = asset as String;
try { try {
results.add(Uri.parse(Uri.encodeFull(stringAsset))); results.add(Uri(pathSegments: stringAsset.split('/')));
} on FormatException { } on FormatException {
globals.printError('Asset manifest contains invalid uri: $asset.'); globals.printError('Asset manifest contains invalid uri: $asset.');
} }
......
...@@ -619,6 +619,28 @@ flutter: ...@@ -619,6 +619,28 @@ flutter:
expect(testLogger.errorText, contains('Asset manifest contains a null or empty uri.')); expect(testLogger.errorText, contains('Asset manifest contains a null or empty uri.'));
expect(assets.length, 1); expect(assets.length, 1);
}); });
testUsingContext('Special characters in asset URIs', () async {
const String manifest = '''
name: test
dependencies:
flutter:
sdk: flutter
flutter:
uses-material-design: true
assets:
- lib/gallery/abc#xyz
- lib/gallery/abc?xyz
- lib/gallery/aaa bbb
''';
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
final List<Uri> assets = flutterManifest.assets;
expect(assets.length, 3);
expect(assets[0].path, 'lib/gallery/abc%23xyz');
expect(assets[1].path, 'lib/gallery/abc%3Fxyz');
expect(assets[2].path, 'lib/gallery/aaa%20bbb');
});
}); });
group('FlutterManifest with MemoryFileSystem', () { group('FlutterManifest with MemoryFileSystem', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment