mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
fix(app): parse response with null body (#4654)
* fix(app): parse response with null body * style(docker): add comment explaining change * fix(images): show correct error when failing import * fix(images): use async await
This commit is contained in:
parent
f674573cdf
commit
0b85684168
3 changed files with 88 additions and 88 deletions
|
@ -18,6 +18,10 @@ function isJSON(jsonString) {
|
|||
// This handler wrap the JSON objects in an array.
|
||||
// Used by the API in: Image push, Image create, Events query.
|
||||
export function jsonObjectsToArrayHandler(data) {
|
||||
// catching empty data helps the function not to fail and prevents unwanted error message to user.
|
||||
if (!data) {
|
||||
return [];
|
||||
}
|
||||
var str = '[' + data.replace(/\n/g, ' ').replace(/\}\s*\{/g, '}, {') + ']';
|
||||
return angular.fromJson(str);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue