Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1eb0bb52
Unverified
Commit
1eb0bb52
authored
Jan 13, 2021
by
Jonah Williams
Committed by
GitHub
Jan 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] dont crash on invalid utf8 in pubspec (#73891)
parent
d4f0c082
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
project.dart
packages/flutter_tools/lib/src/project.dart
+6
-0
project_test.dart
packages/flutter_tools/test/general.shard/project_test.dart
+16
-0
No files found.
packages/flutter_tools/lib/src/project.dart
View file @
1eb0bb52
...
...
@@ -221,6 +221,12 @@ class FlutterProject {
}
on
YamlException
catch
(
e
)
{
logger
.
printStatus
(
'Error detected in pubspec.yaml:'
,
emphasis:
true
);
logger
.
printError
(
'
$e
'
);
}
on
FormatException
catch
(
e
)
{
logger
.
printError
(
'Error detected while parsing pubspec.yaml:'
,
emphasis:
true
);
logger
.
printError
(
'
$e
'
);
}
on
FileSystemException
catch
(
e
)
{
logger
.
printError
(
'Error detected while reading pubspec.yaml:'
,
emphasis:
true
);
logger
.
printError
(
'
$e
'
);
}
if
(
manifest
==
null
)
{
throwToolExit
(
'Please correct the pubspec.yaml file at
$path
'
);
...
...
packages/flutter_tools/test/general.shard/project_test.dart
View file @
1eb0bb52
...
...
@@ -37,6 +37,22 @@ void main() {
);
});
testWithoutContext
(
'invalid utf8 throws a tool exit'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FlutterProjectFactory
projectFactory
=
FlutterProjectFactory
(
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
);
fileSystem
.
file
(
'pubspec.yaml'
).
writeAsBytesSync
(<
int
>[
0xFFFE
]);
/// Technically this should throw a FileSystemException but this is
/// currently a bug in package:file.
expect
(
()
=>
projectFactory
.
fromDirectory
(
fileSystem
.
currentDirectory
),
throwsToolExit
(),
);
});
_testInMemory
(
'fails on invalid pubspec.yaml'
,
()
async
{
final
Directory
directory
=
globals
.
fs
.
directory
(
'myproject'
);
directory
.
childFile
(
'pubspec.yaml'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment