Skip to content

Commit fb9d377

Browse files
committed
Added a note about using slashes and the special _format param
1 parent 487e918 commit fb9d377

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)