Skip to content

Commit

Permalink
refactor(settings): improve validation for excluded profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sereneblue committed May 9, 2020
1 parent 2668bc1 commit 0a76fb7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/lib/chameleon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,16 +920,15 @@ export class Chameleon {
msg,
};
} else {
if (!impSettings.excluded.every(p => profileIds.includes(p))) {
msg = browser.i18n.getMessage('options-import-invalid-excludedProfile');
let excludedProfiles = [];

return {
error : true,
msg,
};
} else {
s.excluded = impSettings.excluded;
for (let p of impSettings.excluded) {
if (profileIds.includes(p)) {
excludedProfiles.push(p);
}
}

s.excluded = excludedProfiles;
}

if (!impSettings.ipRules) {
Expand Down

0 comments on commit 0a76fb7

Please sign in to comment.