Saturday, April 23, 2016

Re: Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? )

URLs have different parts or components. The different parts use different escaping rules.


foo.com: uses DNS escaping rules

/: uses path escaping rules, which allows / as a path separator

next=%2Fsome%2Ffolder: uses query parameter escaping rules, which does not allow "/"

Stuff after a "?" but before a "#" are query parameters, and it follows different escaping rules than the path part.

On Sat, Apr 23, 2016 at 4:38 PM, Chris Seberino <cseberino@gmail.com> wrote:


On Saturday, April 23, 2016 at 2:47:58 PM UTC-5, François Schiettecatte wrote:
Because the slashes are escaped, this is normal as they are a parameter and not part of the path itself.

Why URLs created by Django show /'s instead of %2F's?  The Django code knows how to
fix the appearance?!

The escaped version only appears on handmade URLs created in a view and used
for a redirect?  Somehow I'm omitting some magic Django code uses. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1add5bc5-23df-4617-a3ed-f624d93cff4d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD4ANxXCmorwwGi%2BwFmxAHBf2A-nL%3DeO%3DzeFnnpo7hoDJfLTnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment