Disallow empty platforms and specific platforms when parsing manifest for plugins (#49262)
This commit is contained in:
@@ -202,9 +202,12 @@ class Plugin {
|
||||
|
||||
static List<String> _validateMultiPlatformYaml(YamlMap yaml) {
|
||||
bool isInvalid(String key, bool Function(YamlMap) validate) {
|
||||
if (!yaml.containsKey(key)) {
|
||||
return false;
|
||||
}
|
||||
final dynamic value = yaml[key];
|
||||
if (value is! YamlMap) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
final YamlMap yamlValue = value as YamlMap;
|
||||
if (yamlValue.containsKey('default_package')) {
|
||||
@@ -212,6 +215,10 @@ class Plugin {
|
||||
}
|
||||
return !validate(yamlValue);
|
||||
}
|
||||
|
||||
if (yaml == null) {
|
||||
return <String>['Invalid "platforms" specification.'];
|
||||
}
|
||||
final List<String> errors = <String>[];
|
||||
if (isInvalid(AndroidPlugin.kConfigKey, AndroidPlugin.validate)) {
|
||||
errors.add('Invalid "android" plugin specification.');
|
||||
|
||||
Reference in New Issue
Block a user