Merge pull request #762 from keepassxreboot/fix/remove_duplicate_entries

Remove duplicate entries
This commit is contained in:
Sami Vänttinen 2020-02-09 16:56:23 +02:00 committed by GitHub
commit 564da885b4

View file

@ -255,7 +255,7 @@ keepass.retrieveCredentials = async function(tab, args = []) {
keepass.setcurrentKeePassXCVersion(parsed.version);
if (keepass.verifyResponse(parsed, incrementedNonce)) {
entries = parsed.entries;
entries = removeDuplicateEntries(parsed.entries);
keepass.updateLastUsed(keepass.databaseHash);
if (entries.length === 0) {
// Questionmark-icon is not triggered, so we have to trigger for the normal symbol
@ -1214,3 +1214,17 @@ keepass.buildRequest = function(action, encrypted, nonce, clientID, triggerUnloc
keepass.getIsKeePassXCAvailable = async function() {
return keepass.isKeePassXCAvailable;
};
const removeDuplicateEntries = function(arr) {
const newArray = [];
for (const a of arr) {
if (newArray.some(i => i.uuid === a.uuid)) {
continue;
}
newArray.push(a);
}
return newArray;
};