From e11cf5c94c3fbea34c77c7629a9d61fab2558d49 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 12 Jan 2018 17:54:49 -0800 Subject: [PATCH] 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 --- packages/flutter_tools/lib/src/commands/screenshot.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/flutter_tools/lib/src/commands/screenshot.dart b/packages/flutter_tools/lib/src/commands/screenshot.dart index 59e56f9ded..51554fb999 100644 --- a/packages/flutter_tools/lib/src/commands/screenshot.dart +++ b/packages/flutter_tools/lib/src/commands/screenshot.dart @@ -89,7 +89,9 @@ class ScreenshotCommand extends FlutterCommand { await sink.close(); await showOutputFileInfo(outputFile); 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"')) throwToolExit('\nIt appears the output file contains an error message, not valid skia output.'); }