Skip to content

Commit 8f1869c

Browse files
committed
fix: Trailing slash in APIBlueprint in register_api
1 parent 3b225c6 commit 8f1869c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

flask_openapi3/api_blueprint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ def register_api(self, api: "APIBlueprint") -> None:
6363
self.tags.append(tag)
6464

6565
for path_url, path_item in api.paths.items():
66+
trail_slash = path_url.endswith('/')
6667
# merge url_prefix and new api blueprint path url
6768
uri = self.url_prefix.rstrip("/") + "/" + path_url.lstrip("/") if self.url_prefix else path_url
6869
# strip the right slash
69-
uri = uri.rstrip('/')
70+
if not trail_slash:
71+
uri = uri.rstrip('/')
7072
self.paths[uri] = path_item
7173

7274
self.components_schemas.update(**api.components_schemas)

0 commit comments

Comments
 (0)