Bugzilla – Attachment 100705 Details for
Bug 24384
Add Access-Control-Allow-Origin support to OPAC reports svc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc
Bug-24384-Add-Access-Control-Allow-Origin-support-.patch (text/plain), 1.52 KB, created by
David Nind
on 2020-03-15 19:19:27 UTC
(
hide
)
Description:
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-03-15 19:19:27 UTC
Size:
1.52 KB
patch
obsolete
>From 1524110aee52c4ab9169df401773edf895657ea6 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 9 Jan 2020 11:45:14 -0300 >Subject: [PATCH] Bug 24384: Add Access-Control-Allow-Origin support to OPAC > reports svc > >This patch makes the opac/svc/report script use output_with_http_headers >so it sets the Access-Control-Allow-Origin header. > >To test: >1. Create a new public report and remember the report id >2. Use your favourite too to fetch the report in JSON by issuing: > GET http://localhost:8080/cgi-bin/koha/svc/report?id=1 >=> FAIL: There is no Access-Control-Allow-Origin header >3. Apply this patch >4. Restart Plack > $ sudo koha-plack --restart kohadev >5. Set the AccessControlAllowOrigin to anything (for example, > https://koha-community.org) >6. Repeat 2 >=> SUCCESS: On the response headers you find >Access-Control-Allow-Origin: https://koha-community.org >7. Sign off :-D > >Signed-off-by: David Nind <david@davidnind.com> >--- > opac/svc/report | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > >diff --git a/opac/svc/report b/opac/svc/report >index dac74277db..ef07334573 100755 >--- a/opac/svc/report >+++ b/opac/svc/report >@@ -23,6 +23,7 @@ > > use Modern::Perl; > >+use C4::Output qw(output_with_http_headers); > use C4::Reports::Guided; > use Koha::Reports; > use JSON; >@@ -85,8 +86,4 @@ unless ($json_text) { > } > } > >-print $query->header( >- -charset => 'UTF-8', >- -type => 'application/json' >-); >-print $json_text; >+output_with_http_headers( $query, undef, $json_text, 'json'); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24384
:
97095
|
100705
|
100732