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
4ce27ea0
Unverified
Commit
4ce27ea0
authored
Oct 15, 2020
by
Jonah Williams
Committed by
GitHub
Oct 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] update metadata detection to account for invalid yaml (#68243)
parent
a69e393d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
flutter_project_metadata.dart
packages/flutter_tools/lib/src/flutter_project_metadata.dart
+6
-1
flutter_project_metadata_test.dart
...ols/test/general.shard/flutter_project_metadata_test.dart
+11
-0
No files found.
packages/flutter_tools/lib/src/flutter_project_metadata.dart
View file @
4ce27ea0
...
...
@@ -85,7 +85,12 @@ class FlutterProjectMetadata {
if
(!
_metadataFile
.
existsSync
())
{
return
null
;
}
final
dynamic
metadataYaml
=
loadYaml
(
_metadataFile
.
readAsStringSync
());
dynamic
metadataYaml
;
try
{
metadataYaml
=
loadYaml
(
_metadataFile
.
readAsStringSync
());
}
on
YamlException
{
// Handled in return below.
}
if
(
metadataYaml
is
YamlMap
)
{
_metadataYaml
=
metadataYaml
;
}
else
{
...
...
packages/flutter_tools/test/general.shard/flutter_project_metadata_test.dart
View file @
4ce27ea0
...
...
@@ -41,6 +41,17 @@ void main() {
expect
(
logger
.
traceText
,
contains
(
'.metadata version is malformed.'
));
});
testWithoutContext
(
'project metadata fields are empty when file is not valid yaml'
,
()
{
metadataFile
.
writeAsStringSync
(
' channel: @something'
);
final
FlutterProjectMetadata
projectMetadata
=
FlutterProjectMetadata
(
metadataFile
,
logger
);
expect
(
projectMetadata
.
projectType
,
isNull
);
expect
(
projectMetadata
.
versionChannel
,
isNull
);
expect
(
projectMetadata
.
versionRevision
,
isNull
);
expect
(
logger
.
traceText
,
contains
(
'.metadata project_type version is malformed.'
));
expect
(
logger
.
traceText
,
contains
(
'.metadata version is malformed.'
));
});
testWithoutContext
(
'projectType is populated when version is malformed'
,
()
{
metadataFile
..
createSync
()
...
...
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