]> 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)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 18 Jun 2019 16:34:44 +0000 (17:34 +0100)
commit688967e6eaab4c1f5670cbef254cb4a7101c4e18
tree992b28f0d36bda0ed69a703c386f899ed8a1037d
parent0cca2795cdae643a6a94b95ad7879c363006cfed
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>
Koha/REST/Plugin/PluginRoutes.pm
Koha/REST/V1/Static.pm [new file with mode: 0644]