aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-10-21 15:22:11 +0200
committerGitHub <noreply@github.com>2016-10-21 15:22:11 +0200
commite8331dd9e7772a396bb211459eca4a682c8e947e (patch)
tree7258769d31ae352ba1021b7e87fc8aa3bf2d80cf
parent61477368687e048f3001336327923f5c87fa2592 (diff)
parent5960aa1ffc8ee07850d4865a8df7440750af4b2b (diff)
downloadwallabag-e8331dd9e7772a396bb211459eca4a682c8e947e.tar.gz
wallabag-e8331dd9e7772a396bb211459eca4a682c8e947e.tar.zst
wallabag-e8331dd9e7772a396bb211459eca4a682c8e947e.zip
Merge pull request #2453 from wallabag/fix-api-export
Fix API export
-rw-r--r--app/config/config.yml27
-rw-r--r--app/config/routing_rest.yml5
-rw-r--r--composer.json4
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php3
4 files changed, 29 insertions, 10 deletions
diff --git a/app/config/config.yml b/app/config/config.yml
index 2f102c45..b4760073 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -112,12 +112,26 @@ swiftmailer:
112fos_rest: 112fos_rest:
113 param_fetcher_listener: true 113 param_fetcher_listener: true
114 body_listener: true 114 body_listener: true
115 format_listener: true
116 view: 115 view:
116 mime_types:
117 csv:
118 - 'text/csv'
119 - 'text/plain'
120 pdf:
121 - 'application/pdf'
122 epub:
123 - 'application/epub+zip'
124 mobi:
125 - 'application/x-mobipocket-ebook'
117 view_response_listener: 'force' 126 view_response_listener: 'force'
118 formats: 127 formats:
119 xml: true 128 xml: true
120 json : true 129 json: true
130 txt: true
131 csv: true
132 pdf: true
133 epub: true
134 mobi: true
121 templating_formats: 135 templating_formats:
122 html: true 136 html: true
123 force_redirects: 137 force_redirects:
@@ -126,6 +140,15 @@ fos_rest:
126 default_engine: twig 140 default_engine: twig
127 routing_loader: 141 routing_loader:
128 default_format: json 142 default_format: json
143 format_listener:
144 enabled: true
145 rules:
146 - { path: "^/api/entries/([0-9]+)/export.(.*)", priorities: ['epub', 'mobi', 'pdf', 'txt', 'csv'], fallback_format: false, prefer_extension: false }
147 - { path: "^/api", priorities: ['json', 'xml'], fallback_format: false, prefer_extension: false }
148 - { path: "^/annotations", priorities: ['json', 'xml'], fallback_format: false, prefer_extension: false }
149 # for an unknown reason, EACH REQUEST goes to FOS\RestBundle\EventListener\FormatListener
150 # so we need to add custom rule for custom api export but also for all other routes of the application...
151 - { path: '^/', priorities: ['text/html', '*/*'], fallback_format: html, prefer_extension: false }
129 152
130nelmio_api_doc: 153nelmio_api_doc:
131 sandbox: 154 sandbox:
diff --git a/app/config/routing_rest.yml b/app/config/routing_rest.yml
index 52d395dd..29f4ab14 100644
--- a/app/config/routing_rest.yml
+++ b/app/config/routing_rest.yml
@@ -1,4 +1,3 @@
1Rest_Wallabag: 1Rest_Wallabag:
2 type : rest 2 type : rest
3 resource: "@WallabagApiBundle/Resources/config/routing_rest.yml" 3 resource: "@WallabagApiBundle/Resources/config/routing_rest.yml"
4
diff --git a/composer.json b/composer.json
index 79de337b..4f7ad291 100644
--- a/composer.json
+++ b/composer.json
@@ -54,8 +54,8 @@
54 "sensio/framework-extra-bundle": "^3.0.2", 54 "sensio/framework-extra-bundle": "^3.0.2",
55 "incenteev/composer-parameter-handler": "^2.0", 55 "incenteev/composer-parameter-handler": "^2.0",
56 "nelmio/cors-bundle": "~1.4.0", 56 "nelmio/cors-bundle": "~1.4.0",
57 "friendsofsymfony/rest-bundle": "~1.4", 57 "friendsofsymfony/rest-bundle": "~2.1",
58 "jms/serializer-bundle": "~1.0", 58 "jms/serializer-bundle": "~1.1",
59 "nelmio/api-doc-bundle": "~2.7", 59 "nelmio/api-doc-bundle": "~2.7",
60 "mgargano/simplehtmldom": "~1.5", 60 "mgargano/simplehtmldom": "~1.5",
61 "tecnickcom/tcpdf": "~6.2", 61 "tecnickcom/tcpdf": "~6.2",
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
index fa573988..3437bb9b 100644
--- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
@@ -12,7 +12,6 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
12use Symfony\Component\Security\Core\Exception\AccessDeniedException; 12use Symfony\Component\Security\Core\Exception\AccessDeniedException;
13use Wallabag\CoreBundle\Entity\Entry; 13use Wallabag\CoreBundle\Entity\Entry;
14use Wallabag\CoreBundle\Entity\Tag; 14use Wallabag\CoreBundle\Entity\Tag;
15use FOS\RestBundle\Controller\Annotations\Route;
16 15
17class WallabagRestController extends FOSRestController 16class WallabagRestController extends FOSRestController
18{ 17{
@@ -167,8 +166,6 @@ class WallabagRestController extends FOSRestController
167 * } 166 * }
168 * ) 167 * )
169 * 168 *
170 * @Route(requirements={"_format"="epub|mobi|pdf|txt|csv"})
171 *
172 * @return Response 169 * @return Response
173 */ 170 */
174 public function getEntryExportAction(Entry $entry, Request $request) 171 public function getEntryExportAction(Entry $entry, Request $request)