strip static url trailing slash at assignment

This commit is contained in:
David Lord 2019-05-25 11:14:49 -07:00
parent a12bf290da
commit ed9ab2d3b6
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
5 changed files with 21 additions and 19 deletions

View file

@ -408,11 +408,8 @@ class Flask(_PackageBoundObject):
self, import_name, template_folder=template_folder, root_path=root_path
)
if static_url_path is not None:
self.static_url_path = static_url_path
if static_folder is not None:
self.static_folder = static_folder
self.static_url_path = static_url_path
self.static_folder = static_folder
if instance_path is None:
instance_path = self.auto_find_instance_path()
@ -594,7 +591,7 @@ class Flask(_PackageBoundObject):
bool(static_host) == host_matching
), "Invalid static_host/host_matching combination"
self.add_url_rule(
self.static_url_path.rstrip("/") + "/<path:filename>",
self.static_url_path + "/<path:filename>",
endpoint="static",
host=static_host,
view_func=self.send_static_file,