-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jmap_contact: add disableUriAsBlobId argument to Card{get/parse}
Signed-off-by: Robert Stepanek <[email protected]>
- Loading branch information
Showing
3 changed files
with
188 additions
and
71 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
cassandane/tiny-tests/JMAPContacts/card_get_disable_uri_as_blobid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
|
||
sub test_card_get_disable_uri_as_blobid | ||
:min_version_3_9 :needs_component_jmap | ||
{ | ||
my ($self) = @_; | ||
my $jmap = $self->{jmap}; | ||
my $carddav = $self->{carddav}; | ||
|
||
my $vcard = <<'EOF'; | ||
BEGIN:VCARD | ||
VERSION:4.0 | ||
UID:85b5d651-1cde-43d9-901d-7059d67807f9 | ||
FN:Jane | ||
PHOTO;PROP-ID=photo1:data:image/x-bla;base64,YmxhYmxhCg= | ||
CREATED:20230823T133154Z | ||
END:VCARD | ||
EOF | ||
$vcard =~ s/\r?\n/\r\n/gs; | ||
$carddav->Request('PUT', 'Default/test.vcf', $vcard, | ||
'Content-Type' => 'text/vcard'); | ||
|
||
my $res = $jmap->CallMethods([ | ||
['ContactCard/get', { | ||
properties => ['media'], | ||
}, 'R1'], | ||
['ContactCard/get', { | ||
properties => ['media'], | ||
disableUriAsBlobId => JSON::true, | ||
}, 'R2'], | ||
]); | ||
|
||
$self->assert_not_null($res->[0][1]{list}[0]{media}{photo1}{blobId}); | ||
$self->assert_null($res->[0][1]{list}[0]{media}{photo1}{uri}); | ||
|
||
$self->assert_null($res->[1][1]{list}[0]{media}{photo1}{blobId}); | ||
$self->assert_not_null($res->[1][1]{list}[0]{media}{photo1}{uri}); | ||
} |
45 changes: 45 additions & 0 deletions
45
cassandane/tiny-tests/JMAPContacts/card_parse_disable_uri_as_blobid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
|
||
sub test_card_parse_disable_uri_as_blobid | ||
:min_version_3_9 :needs_component_jmap | ||
{ | ||
my ($self) = @_; | ||
my $jmap = $self->{jmap}; | ||
my $carddav = $self->{carddav}; | ||
|
||
my $vcard = <<'EOF'; | ||
BEGIN:VCARD | ||
VERSION:4.0 | ||
UID:85b5d651-1cde-43d9-901d-7059d67807f9 | ||
FN:Jane | ||
PHOTO;PROP-ID=photo1:data:image/x-bla;base64,YmxhYmxhCg= | ||
CREATED:20230823T133154Z | ||
END:VCARD | ||
EOF | ||
$vcard =~ s/\r?\n/\r\n/gs; | ||
|
||
my $data = $jmap->Upload($vcard, "text/vcard"); | ||
my $blobId = $data->{blobId}; | ||
$self->assert_not_null($blobId); | ||
|
||
$res = $jmap->CallMethods([ | ||
['ContactCard/parse', { | ||
blobIds => [$blobId], | ||
}, 'R1'], | ||
['ContactCard/parse', { | ||
blobIds => [$blobId], | ||
disableUriAsBlobId => JSON::true, | ||
}, 'R2'], | ||
]); | ||
|
||
$self->assert_not_null($res->[0][1]{parsed}{$blobId}{ | ||
media}{photo1}{blobId}); | ||
$self->assert_null($res->[0][1]{parsed}{$blobId}{ | ||
media}{photo1}{uri}); | ||
|
||
$self->assert_null($res->[1][1]{parsed}{$blobId}{ | ||
media}{photo1}{blobId}); | ||
$self->assert_not_null($res->[1][1]{parsed}{$blobId}{ | ||
media}{photo1}{uri}); | ||
} |
Oops, something went wrong.