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.

apidocs: Fix invalid API page bug.

Suyash Vardhan Mathurd1ccf15cd3df
diff --git a/zerver/views/documentation.py b/zerver/views/documentation.py
index 062d9fd8d0d..4d61f8af558 100644
--- a/zerver/views/documentation.py
+++ b/zerver/views/documentation.py
@@ -106,7 +106,7 @@ class MarkdownDirectoryView(ApiURLView):
with open(article_path) as article_file:
first_line = article_file.readlines()[0]
# Strip the header and then use the first line to get the article title
- if self.path_template == "/zerver/api/%s.md" and first_line[0] != "#":
+ if self.path_template == "/zerver/api/%s.md" and "{generate_api_title(" in first_line:
api_operation = context["OPEN_GRAPH_URL"].split("/api/")[1].replace("-", "_")
endpoint_path, endpoint_method = get_endpoint_from_operationid(api_operation)
article_title = get_openapi_summary(endpoint_path, endpoint_method)