aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-04-26 13:40:58 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-04-26 13:40:58 +0200
commit68a90821a305867e9b655da2dbfe558d37253990 (patch)
tree5d87be5998bedfc2e25099be17fdc1f3e5cc45ed
parentf277bc042c8e805aab14b31b5b51e2878d80c6f4 (diff)
downloadwallabag-68a90821a305867e9b655da2dbfe558d37253990.tar.gz
wallabag-68a90821a305867e9b655da2dbfe558d37253990.tar.zst
wallabag-68a90821a305867e9b655da2dbfe558d37253990.zip
Handle redirection from previous feeds
-rw-r--r--app/config/routing.yml36
-rw-r--r--tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php33
2 files changed, 69 insertions, 0 deletions
diff --git a/app/config/routing.yml b/app/config/routing.yml
index a7c0f7e9..d4defca0 100644
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -59,3 +59,39 @@ fos_js_routing:
59 59
602fa_login_check: 602fa_login_check:
61 path: /2fa_check 61 path: /2fa_check
62
63# redirect RSS feed to Atom
64rss_to_atom_unread:
65 path: /{username}/{token}/unread.xml
66 defaults:
67 _controller: FrameworkBundle:Redirect:redirect
68 route: unread_feed
69 permanent: true
70
71rss_to_atom_archive:
72 path: /{username}/{token}/archive.xml
73 defaults:
74 _controller: FrameworkBundle:Redirect:redirect
75 route: archive_feed
76 permanent: true
77
78rss_to_atom_starred:
79 path: /{username}/{token}/starred.xml
80 defaults:
81 _controller: FrameworkBundle:Redirect:redirect
82 route: starred_feed
83 permanent: true
84
85rss_to_atom_all:
86 path: /{username}/{token}/all.xml
87 defaults:
88 _controller: FrameworkBundle:Redirect:redirect
89 route: all_feed
90 permanent: true
91
92rss_to_atom_tags:
93 path: /{username}/{token}/tags/{slug}.xml
94 defaults:
95 _controller: FrameworkBundle:Redirect:redirect
96 route: tag_feed
97 permanent: true
diff --git a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
index 70f33ebe..d52d7bb8 100644
--- a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
@@ -225,4 +225,37 @@ class FeedControllerTest extends WallabagCoreTestCase
225 $client->request('GET', '/feed/admin/SUPERTOKEN/tags/foo/3000'); 225 $client->request('GET', '/feed/admin/SUPERTOKEN/tags/foo/3000');
226 $this->assertSame(302, $client->getResponse()->getStatusCode()); 226 $this->assertSame(302, $client->getResponse()->getStatusCode());
227 } 227 }
228
229 public function dataForRedirect()
230 {
231 return [
232 [
233 '/admin/YZIOAUZIAO/unread.xml',
234 ],
235 [
236 '/admin/YZIOAUZIAO/starred.xml',
237 ],
238 [
239 '/admin/YZIOAUZIAO/archive.xml',
240 ],
241 [
242 '/admin/YZIOAUZIAO/all.xml',
243 ],
244 [
245 '/admin/YZIOAUZIAO/tags/foo.xml',
246 ],
247 ];
248 }
249
250 /**
251 * @dataProvider dataForRedirect
252 */
253 public function testRedirectFromRssToAtom($url)
254 {
255 $client = $this->getClient();
256
257 $client->request('GET', $url);
258
259 $this->assertSame(301, $client->getResponse()->getStatusCode());
260 }
228} 261}