Skip to content
Myr

Merge pull request #3456 from frostming/bugfix/3452

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix a bug that the static endpoint will unexpectedly catch all

authored by David Lord · committed by GitHub · parents 71b7468, e6178fe · Browse files · 3 files+15 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+15 added−0 removed

  • tests:+11 added−0 removed
  • other:+4 added−0 removed

3 files+15 added−0 removed

modified:src/flask/helpers.py+2 added
998 unmodified lines
999 return os.path.join(self.root_path, self._static_folder)10001001 @static_folder.setter1002 def static_folder(self, value):1003 if value is not None:1004 value = value.rstrip("/\\")1005 self._static_folder = value10061007 @property1008 def static_url_path(self):
147 unmodified lines
modified:tests/test_basic.py+11 added
1423 unmodified lines
1424 assert rv.status_code == 2001425 rv.close()142614271428def test_static_folder_with_ending_slash():1429 app = flask.Flask(__name__, static_folder="static/")14301431 @app.route("/<path:path>")1432 def catch_all(path):1433 return path14341435 rv = app.test_client().get("/catch/all")1436 assert rv.data == b"catch/all"143714381439def test_static_route_with_host_matching():1440 app = flask.Flask(__name__, host_matching=True, static_host="example.com")1441 c = app.test_client()1442 rv = c.get("http://example.com/static/index.html")
536 unmodified lines
modified:CHANGES.rst+2 added
5 unmodified lines
6Unreleased78- Work around an issue when running the ``flask`` command with an9 external debugger on Windows. :issue:`3297`10- The static route will not catch all URLs if the ``Flask``11 ``static_folder`` argument ends with a slash. :issue:`3452`121314Version 1.1.115-------------
1003 unmodified lines