MT#56286 fix subscriberprofile api attribute field

* update_item(): check that $resource->{attributes}
  contains data and an array before processing it
* api-journals.t: fix subscriberprofile 'attributes' field

Change-Id: I28a2e22859cd998f99277e88037dff23981038f3
mr11.2
Kirill Solomko 2 years ago
parent 673ac66c70
commit 766cab0f9c

@ -99,7 +99,10 @@ sub update_item {
return;
}
%{$resource->{attribute}} = map { $_ => 1 } @{ delete $resource->{attributes} };
$resource->{attributes} && ref $resource->{attributes} eq 'ARRAY'
? %{$resource->{attribute}} = map { $_ => 1 } @{ delete $resource->{attributes} }
: $resource->{attribute} = {};
$form //= $self->get_form($c);
return unless $self->validate_form(
c => $c,

@ -1303,7 +1303,7 @@ sub test_subscriberprofile {
$req->content(JSON::to_json({
name => "subscriber_profile_".($t-1).'_put',
profile_set_id => $profileset->{id},
attribute => \@attributes,
attributes => \@attributes,
set_default => JSON::false,
($mysql_sqlstrict ? (description => "subscriber_profile_description_".($t-1).'_put') : ()),
}));

Loading…
Cancel
Save