Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
documentation: Move check for `api-doc-template.md`.
Lauryn Menardfc54ffd778f7
diff --git a/zerver/tests/test_urls.py b/zerver/tests/test_urls.pyindex 6cd7c28b838..cc31cc6869e 100644--- a/zerver/tests/test_urls.py+++ b/zerver/tests/test_urls.py@@ -64,7 +64,12 @@ class PublicURLTest(ZulipTestCase):"/api/v1/messages","/api/v1/streams",],- 404: ["/help/nonexistent", "/help/include/admin", "/help/" + "z" * 1000],+ 404: [+ "/help/api-doc-template",+ "/help/nonexistent",+ "/help/include/admin",+ "/help/" + "z" * 1000,+ ],}# Add all files in help documentation directory (except for 'index.md',diff --git a/zerver/views/documentation.py b/zerver/views/documentation.pyindex e2f472a3758..0b8a0dbe88a 100644--- a/zerver/views/documentation.py+++ b/zerver/views/documentation.py@@ -76,6 +76,10 @@ class MarkdownDirectoryView(ApiURLView):article = "index"elif article == "include/sidebar_index":pass+ elif article == "api-doc-template":+ # This markdown template shouldn't be accessed directly.+ article = "missing"+ http_status = 404elif "/" in article:article = "missing"http_status = 404@@ -101,15 +105,6 @@ class MarkdownDirectoryView(ApiURLView):endpoint_method=None,)- if path == "/zerver/api/api-doc-template.md":- # This template shouldn't be accessed directly.- return DocumentationArticle(- article_path=self.path_template % ("missing",),- article_http_status=404,- endpoint_path=None,- endpoint_method=None,- )-if self.path_template == "/zerver/api/%s.md":# Hack: `self.path_template` has a leading `/`, so we use + to add directories.api_documentation_path = os.path.join(settings.DEPLOY_ROOT, "templates") + path