Unverified Commit e11cf5c9 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Use a safe codec to read Skia SKP screenshot files when checking for errors (#14086)

If the downloaded file is an actual SKP and not an error report, then the
default UTF-8 codec will fail to decode the SKP content
parent 27eeb972
...@@ -89,7 +89,9 @@ class ScreenshotCommand extends FlutterCommand { ...@@ -89,7 +89,9 @@ class ScreenshotCommand extends FlutterCommand {
await sink.close(); await sink.close();
await showOutputFileInfo(outputFile); await showOutputFileInfo(outputFile);
if (await outputFile.length() < 1000) { if (await outputFile.length() < 1000) {
final String content = await outputFile.readAsString(); final String content = await outputFile.readAsString(
encoding: const AsciiCodec(allowInvalid: true),
);
if (content.startsWith('{"jsonrpc":"2.0", "error"')) if (content.startsWith('{"jsonrpc":"2.0", "error"'))
throwToolExit('\nIt appears the output file contains an error message, not valid skia output.'); throwToolExit('\nIt appears the output file contains an error message, not valid skia output.');
} }
......
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