From ed6194f3b87bf61ac6565d872e44f414ee8238bc Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 14 Apr 2022 12:22:27 +0100 Subject: [PATCH] Bug 30536: Refer to parameters enum This patch updates the stash_embed method to use the parameters hash enum instead of the top level x-koha-embed custom definition. This way we can remove the requirement for defining this list twice. Signed-off-by: Tomas Cohen Arazi --- Koha/REST/Plugin/Query.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/REST/Plugin/Query.pm b/Koha/REST/Plugin/Query.pm index 396af699b9..f14fa6fdc9 100644 --- a/Koha/REST/Plugin/Query.pm +++ b/Koha/REST/Plugin/Query.pm @@ -240,7 +240,11 @@ Merges parameters from $q_params into $filtered_params. my $spec = $args->{spec} // {}; - my $embed_spec = $spec->{'x-koha-embed'}; + my $embed_spec; + for my $param (@{$spec->{parameters}}) { + next unless $param->{name} eq 'x-koha-embed'; + $embed_spec = $param->{items}->{enum}; + } my $embed_header = $c->req->headers->header('x-koha-embed'); Koha::Exceptions::BadParameter->throw("Embedding objects is not allowed on this endpoint.") -- 2.34.1