1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03:35 +00:00

Better error handling for imports. Check for bad CSV data on lastpass (when no header row is included).

This commit is contained in:
Kyle Spearrin
2016-11-09 00:41:17 -05:00
parent 93b96b3be7
commit 8313d9fa90
2 changed files with 43 additions and 8 deletions

View File

@@ -172,7 +172,8 @@
function parseData(data) {
var folders = [],
sites = [],
siteRelationships = [];
siteRelationships = [],
badDataSites = 0;
angular.forEach(data, function (value, key) {
var folderIndex = folders.length,
@@ -190,6 +191,10 @@
}
}
if ((!value.name || value.name === '') && (!value.password || value.password === '')) {
badDataSites++;
}
sites.push({
favorite: value.fav === '1',
uri: value.url && value.url !== '' ? trimUri(value.url) : null,
@@ -214,7 +219,12 @@
}
});
success(folders, sites, siteRelationships);
if (badDataSites > (data.length / 2)) {
error('CSV data is not formatted correctly from LastPass. Please check your import file and try again.');
}
else {
success(folders, sites, siteRelationships);
}
}
}