Skip to content

Commit 3fc4eee

Browse files
committed
minor symfony#9165 Added a note about using slashes and the special _format param (javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- Added a note about using slashes and the special _format param This replaces symfony#7973. Commits ------- fb9d377 Added a note about using slashes and the special _format param
2 parents 2a215c4 + fb9d377 commit 3fc4eee

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

routing/slash_in_parameter.rst

+9
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ a more permissive regular expression for it:
7777
7878
That's it! Now, the ``{token}`` parameter can contain the ``/`` character.
7979

80+
.. note::
81+
82+
If the route includes the special ``{_format}`` placeholder, you shouldn't
83+
use the ``.+`` requirement for the parameters that allow slashes. For example,
84+
if the pattern is ``/share/{token}.{_format}`` and ``{token}`` allows any
85+
character, the ``/share/foo/bar.json`` URL will consider ``foo/bar.json``
86+
as the token and the format will be empty. This can be solved replacing the
87+
``.+`` requirement by ``[^.]+`` to allow any character except dots.
88+
8089
.. note::
8190

8291
If the route defines several placeholders and you apply this permissive

0 commit comments

Comments
 (0)