diff options
author | eleith <online+github@eleith.com> | 2020-04-22 18:15:27 +0000 |
---|---|---|
committer | eleith <online+github@eleith.com> | 2020-04-22 18:15:27 +0000 |
commit | 728434531d2ba7aff8020f5b6727dd63f9485526 (patch) | |
tree | 1e5ecea8481b597502ae7d7a5b400bf7a731aa34 /src | |
parent | 10b916034cccb9705a2c5a4e05067eb2a2a68efc (diff) |
support different rev value types depending on vcard version
Diffstat (limited to 'src')
-rw-r--r-- | src/services/checks/invalidREV.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/services/checks/invalidREV.js b/src/services/checks/invalidREV.js index 94af2870..59ec01ed 100644 --- a/src/services/checks/invalidREV.js +++ b/src/services/checks/invalidREV.js @@ -28,10 +28,21 @@ export default { name: 'invalid REV', run: contact => { try { - if (contact.vCard.hasProperty('rev') - && contact.vCard.getFirstProperty('rev').getFirstValue() - && contact.vCard.getFirstProperty('rev').getFirstValue().icalclass === 'vcardtime') { - return false + const hasRev = contact.vCard.hasProperty('rev') + const rev = hasRev && contact.vCard.getFirstProperty('rev') + const revValue = rev && rev.getFirstValue() + + if (revValue) { + const version = contact.version + const type = revValue.icalclass + + if (version === '3.0' && type === 'vcardtime') { + return false + } + + if (contact.version === '4.0' && type === 'icaltime') { + return false + } } } catch (error) { return true |