This commit is contained in:
Berk 2025-12-16 21:09:33 +00:00 committed by GitHub
commit 88cf28467e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -1,3 +1,4 @@
import html as html_escape
import json import json
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
@ -121,7 +122,7 @@ def get_swagger_ui_html(
<head> <head>
<link type="text/css" rel="stylesheet" href="{swagger_css_url}"> <link type="text/css" rel="stylesheet" href="{swagger_css_url}">
<link rel="shortcut icon" href="{swagger_favicon_url}"> <link rel="shortcut icon" href="{swagger_favicon_url}">
<title>{title}</title> <title>{html_escape.escape(title)}</title>
</head> </head>
<body> <body>
<div id="swagger-ui"> <div id="swagger-ui">
@ -130,7 +131,7 @@ def get_swagger_ui_html(
<!-- `SwaggerUIBundle` is now available on the page --> <!-- `SwaggerUIBundle` is now available on the page -->
<script> <script>
const ui = SwaggerUIBundle({{ const ui = SwaggerUIBundle({{
url: '{openapi_url}', url: '{html_escape.escape(openapi_url)}',
""" """
for key, value in current_swagger_ui_parameters.items(): for key, value in current_swagger_ui_parameters.items():
@ -221,7 +222,7 @@ def get_redoc_html(
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>{title}</title> <title>{html_escape.escape(title)}</title>
<!-- needed for adaptive design --> <!-- needed for adaptive design -->
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@ -246,7 +247,7 @@ def get_redoc_html(
<noscript> <noscript>
ReDoc requires Javascript to function. Please enable it to browse the documentation. ReDoc requires Javascript to function. Please enable it to browse the documentation.
</noscript> </noscript>
<redoc spec-url="{openapi_url}"></redoc> <redoc spec-url="{html_escape.escape(openapi_url)}"></redoc>
<script src="{redoc_js_url}"> </script> <script src="{redoc_js_url}"> </script>
</body> </body>
</html> </html>