Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #31097 from arcturus/bug-1178241
Browse files Browse the repository at this point in the history
Bug 1178241 - [vCard] 'undefined' is displayed when a field exist but…
  • Loading branch information
arcturus committed Aug 5, 2015
2 parents b795c40 + c7b6b76 commit 74b3468
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/communications/contacts/test/unit/vcard_parsing_test.js
Expand Up @@ -671,5 +671,16 @@ suite('vCard parsing settings', function() {
});
});
});
test('- vcard with fields with empty values', function(done) {
initializeVCFReader('vcard_undefined.vcf', function(reader) {
reader.onread = stub();
reader.onimported = stub();
reader.onerror = stub();
reader.process(function(result) {
sinon.assert.length(result, 1);
sinon.assert.length(result[0].org, 0);
});
});
});
});
});
@@ -0,0 +1,7 @@
BEGIN:VCARD
VERSION:3.0
FN;CHARSET=utf-8:First Last
N;CHARSET=utf-8:Last;First;;
ORG:;
EMAIL;TYPE=HOME;TYPE=PREF:first.last@email.tld
END:VCARD
4 changes: 4 additions & 0 deletions shared/js/contacts/import/utilities/vcard_parser.js
Expand Up @@ -472,6 +472,10 @@ var VCFReader = (function _VCFReader() {

var v = vcardObj[field][0];

if (!v || !Array.isArray(v.value) || v.value.length === 0) {
return;
}

var dateValue;
if (field === 'bday') {
dateValue = v.value[0];
Expand Down

0 comments on commit 74b3468

Please sign in to comment.