mirror of
https://github.com/nextcloud/passman.git
synced 2025-02-25 07:53:32 +08:00
add basic error handling for failed custom field file data parsing on csv import
This commit is contained in:
parent
c4ccaa78c4
commit
ca826072bd
1 changed files with 15 additions and 4 deletions
|
@ -168,9 +168,13 @@
|
|||
filename: row[k][j].value.filename,
|
||||
size: row[k][j].value.size,
|
||||
mimetype: row[k][j].value.mimetype,
|
||||
data: row[k][j].value.file_data
|
||||
data: row[k][j].value.file_data ? row[k][j].value.file_data : row[k][j].value.data
|
||||
};
|
||||
|
||||
if (_file.data === undefined) {
|
||||
console.error('Unable to parse file data from ', row[k][j]);
|
||||
$scope.log.push('Unable to parse file data from file ' + _file.filename);
|
||||
continue;
|
||||
}
|
||||
row[k][j].value = await FileService.uploadFile(_file).then(FileService.getEmptyFileWithDecryptedFilename);
|
||||
}
|
||||
_credential.custom_fields.push(row[k][j]);
|
||||
|
@ -184,7 +188,7 @@
|
|||
filename: row[k][i].filename,
|
||||
size: row[k][i].size,
|
||||
mimetype: row[k][i].mimetype,
|
||||
data: row[k][i].file_data
|
||||
data: row[k][i].file_data ? row[k][i].file_data : row[k][i].data
|
||||
}).then(FileService.getEmptyFileWithDecryptedFilename));
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -197,7 +201,7 @@
|
|||
filename: row[k][j].filename,
|
||||
size: row[k][j].size,
|
||||
mimetype: row[k][j].mimetype,
|
||||
data: row[k][j].file_data
|
||||
data: row[k][j].file_data ? row[k][j].file_data : row[k][j].data
|
||||
}).then(FileService.getEmptyFileWithDecryptedFilename));
|
||||
}
|
||||
}
|
||||
|
@ -321,5 +325,12 @@
|
|||
var start = ($scope.skipFirstRow) ? 1 : 0;
|
||||
$scope.inspectCredential($scope.parsed_csv[start]);
|
||||
};
|
||||
|
||||
$scope.fileLoadError = function (file) {
|
||||
console.error($translate.instant('error.loading.file'), file);
|
||||
};
|
||||
$scope.fileSelectProgress = function () {
|
||||
|
||||
};
|
||||
}]);
|
||||
}());
|
||||
|
|
Loading…
Reference in a new issue