Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Validate `URL` property

  • Loading branch information...
commit c3d6400af57bda2af9e9d272ef7a66d5594026e3 1 parent 4c5b69c
@l0b0 authored
View
4 vcard/test/maximal.vcf
@@ -10,8 +10,8 @@ ORG:Example Organization;Example Department;Example Sub-Department;Example
Office
LOGO;VALUE=uri:http://example.org/example.svg
TITLE:Assistant assessor
-URL;TYPE=WORK:http://example.org/example-department/example-sub-department/
- example-office
+URL:http://example.org/example-department/example-sub-department/example-of
+ fice
EMAIL;TYPE=INTERNET;TYPE=PREF;TYPE=WORK:jdoe+work-related@example.org
TEL;TYPE=VOICE;TYPE=PREF;TYPE=MSG;TYPE=WORK:+1234567890
TEL;TYPE=FAX;TYPE=WORK:+0123456789
View
8 vcard/test/test_package.py
@@ -145,7 +145,9 @@ def _get_vcard_file(path):
'missing_n_value.vcf',)}
VCARDS_NON_EMPTY_PARAM = {
'message': vcard_defs.MSG_NON_EMPTY_PARAM,
- 'vcards': tuple()}
+ 'vcards': (
+ 'http://aspaass.no/kontakt/Aspaas%20Sykler.vcf',
+ 'http://www.troywolf.com/articles/php/class_vcard/vcard_example.php')}
VCARDS_WITH_ERROR = (
VCARDS_CONTINUATION_AT_START,
@@ -188,9 +190,7 @@ def _get_vcard_file(path):
VCARDS_VALID = (
'minimal.vcf',
'maximal.vcf',
- 'scrambled_case.vcf',
- 'http://aspaass.no/kontakt/Aspaas%20Sykler.vcf',
- 'http://www.troywolf.com/articles/php/class_vcard/vcard_example.php'
+ 'scrambled_case.vcf'
)
View
6 vcard/vcard_validators.py
@@ -978,6 +978,12 @@ def validate_vcard_property(prop):
# Inline vCard object
pass # TODO: Un-escape and validate value
+ elif property_name == 'URL':
+ # <http://tools.ietf.org/html/rfc2426#section-3.6.8>
+ _expect_no_params(prop)
+ _expect_value_count(prop['values'], 1)
+ validate_uri(prop['values'][0][0])
+
except VCardFormatError as error:
error.context['Property'] = property_name
raise VCardFormatError(error.message, error.context)
Please sign in to comment.
Something went wrong with that request. Please try again.