Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integrations: Allow trailing slash when redirecting /integration/docs.

Shubham Padia48b1a72859f9
diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py
index ba3ab40d9ee..15fa16cba20 100644
--- a/zerver/tests/test_docs.py
+++ b/zerver/tests/test_docs.py
@@ -416,6 +416,13 @@ class DocPageTest(ZulipTestCase):
legacy_doc_response["Location"], "/integrations/asana?category=project-management"
)
+ legacy_doc_with_trailing_slash_response = self.client_get(
+ "/integrations/doc/asana/",
+ follow=False,
+ )
+ self.assertEqual(legacy_doc_with_trailing_slash_response.status_code, 301)
+ self.assertEqual(legacy_doc_with_trailing_slash_response["Location"], "/integrations/asana")
+
result = self.client_get(
"/integrations/nonexistent_integration",
follow=True,
diff --git a/zproject/urls.py b/zproject/urls.py
index 51f2869974e..ff39f28f95b 100644
--- a/zproject/urls.py
+++ b/zproject/urls.py
@@ -741,6 +741,10 @@ i18n_urls = [
"integrations/doc/<str:integration_name>",
RedirectView.as_view(pattern_name="integration_doc", permanent=True, query_string=True),
),
+ path(
+ "integrations/doc/<str:integration_name>/",
+ RedirectView.as_view(pattern_name="integration_doc", permanent=True, query_string=True),
+ ),
path(
"integrations/<str:integration_name>",
integrations_doc,