Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize subpath redirects on page visit
This fixes an edge case in the FlaskClient (werkzeug.test.Client), used in the Grip.render method, that results in different behavior when calling client.get() with an argument that doesn't have a leading slash. This behaves differently on newer versions of Flask/Werkzeug (likely more strict, which is for the better). This edge case was discovered by a test (namely, testing the '/x/../' route - line 262 in test_api.py). The path gets normalized to '.' since it's relative (then resolves to a path or file in the current directory). On older versions, this would ultimately redirect to '/' and render the specified README and pass the test. In later versions, this the test client would respond with the 404 page since '.' doesn't match any routes. This fix smooths over the difference in behavior by adding the leading slash (making it an absolute path and therefore, will properly match one of the defined routes). This passes the test in both new and old versions of Flask and Werkzeug. A future release may require leading slashes in routes passed to Grip.render to prevent this edge case from leaking and causing surprises in external uses of the function.
- Loading branch information