Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect *pages* when missing trailing slash #278

Merged
merged 3 commits into from
Jul 12, 2023

Conversation

maudetes
Copy link
Contributor

@maudetes maudetes commented Jul 11, 2023

Fix datagouv/data.gouv.fr#1097

Having a trailing slash in @blueprint.route('/pages/<path:slug>/') did not apply redirect when missing trailing slash, due to path: Variable Rule.

Removed the explicit trailing slash in the route but added an explicit redirect if missing. We try to mimic the trailing slash behavior applied by flask in other cases (described in https://flask.palletsprojects.com/en/2.1.x/quickstart/#unique-urls-redirection-behavior).

There may be a better way to have the trailing slash redirect behavior with :path Variable Rule, without having to code it explicitly, but I haven't found find it yet.

@maudetes maudetes merged commit e6cfb8d into datagouv:master Jul 12, 2023
@maudetes maudetes deleted the feat/redirect-pages-missing-slash branch July 12, 2023 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rajouter une redirection fonctionnelle en l'asbence de trailing / sur les *pages*
2 participants