File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -139,18 +139,16 @@ how you're using untrusted data.
139139
140140.. code-block :: python
141141
142+ from flask import request
142143 from markupsafe import escape
143144
144- @app.route (" /<name>" )
145- def hello (name ):
145+ @app.route (" /hello" )
146+ def hello ():
147+ name = request.args.get(" name" , " Flask" )
146148 return f " Hello, { escape(name)} ! "
147149
148- If a user managed to submit the name ``<script>alert("bad")</script> ``,
149- escaping causes it to be rendered as text, rather than running the
150- script in the user's browser.
151-
152- ``<name> `` in the route captures a value from the URL and passes it to
153- the view function. These variable rules are explained below.
150+ If a user submits ``/hello?name=<script>alert("bad")</script> ``, escaping causes
151+ it to be rendered as text, rather than running the script in the user's browser.
154152
155153
156154Routing
You can’t perform that action at this time.
0 commit comments