]> git.koha-community.org Git - koha.git/commit
Bug 22835: Serve plugin static files through API
authorAgustin Moyano <agustinmoyano@theke.io>
Thu, 25 Apr 2019 05:13:37 +0000 (02:13 -0300)
committerLucas Gass <lucas@bywatersolutions.com>
Thu, 6 Feb 2020 21:18:38 +0000 (21:18 +0000)
commit5edcba2f6eab8f08d11d5548b8df3d6617e16a2c
tree873b52fc9ff47ef109d5fbfbb49c9a7cac0c6bcc
parent6465c6f9680c138430b31cc71024d545b9f412ca
Bug 22835: Serve plugin static files through API

This patch serves static files declared within plugins.

To declare static files the plugin must implement the method 'static_routes' which retrieves the spec of static file routes to add to the API.

Once those routes are added to the API, the become available through the /api/v1/contrib/<api_namespace>/static/<path>/<to>/<file>/<filename> endpoint.

To test:
1) Install bug-22835-plugin.kpz
2) Point your browser to /api/v1/contrib/kitchensink/static/static_files/mm.gif
CHECK => No file is served
3) Apply this patch
4) restart_all
5) Repeat step 2.
SUCCESS => File is served!
6) Sign off

Sponsored-by: Theke Solutions
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 688967e6eaab4c1f5670cbef254cb4a7101c4e18)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/REST/Plugin/PluginRoutes.pm
Koha/REST/V1/Static.pm [new file with mode: 0644]