mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Fail early on import, and don't prompt to overwrite when failing (#11059)
* stop importing if JSON parsing fails * fail early if improper JSON we expect to get an array of objects, so show an error message if we find something that is not an array * clarify import error message
This commit is contained in:
parent
3fa65e3855
commit
84d0d65540
1 changed files with 7 additions and 0 deletions
|
@ -164,6 +164,13 @@ uiModules.get('apps/management')
|
|||
docs = JSON.parse(fileContents);
|
||||
} catch (e) {
|
||||
notify.error('The file could not be processed.');
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure we have an array, show an error otherwise
|
||||
if (!Array.isArray(docs)) {
|
||||
notify.error('Saved objects file format is invalid and cannot be imported.');
|
||||
return;
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue