mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-12 13:39:14 +01:00
Report "importFormatError" when header translation did not work, instead of a generic undefined error (startsWith)
This commit is contained in:
parent
a957d7d564
commit
0b037303b1
@ -56,6 +56,12 @@ describe("PasswordXPCsvImporter", () => {
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it("should return success false if CSV headers did not get translated", async () => {
|
||||
const data = germanHeaders.replace("Titel;", "UnknownTitle;");
|
||||
const result: ImportResult = await importer.parse(data);
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it("should skip rows starting with >>>", async () => {
|
||||
const result: ImportResult = await importer.parse(noFolder);
|
||||
expect(result.success).toBe(true);
|
||||
|
@ -55,6 +55,13 @@ export class PasswordXPCsvImporter extends BaseImporter implements Importer {
|
||||
result.success = false;
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
|
||||
// If the first row (header check) does not contain the column "Title", then the data is invalid (no translation found)
|
||||
if (!results[0].Title) {
|
||||
result.success = false;
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
|
||||
let currentFolderName = "";
|
||||
results.forEach((row) => {
|
||||
// Skip rows starting with '>>>' as they indicate items following have no folder assigned to them
|
||||
|
Loading…
Reference in New Issue
Block a user