防止从 URL 中删除等号的 URL 编码 [英] Prevent URL encoding that is removing equals signs from URL
问题描述
正在开发 Django/React 应用程序.我有一些验证电子邮件链接,如下所示:
在 dev env 中,这工作正常,但现在我已准备好投入生产,但无法正常工作.当我点击它时,它会将其转换为: 这会阻止 使用以下内容构建链接. 此外,这是捕获路由的 这些变量应该是 queryGET 请求中的参数.当您构建链接时,您需要在其中将 URL 与查询字符串分开的地方有一个问号: Working on a Django/React app. I have some verification emails links that look like the following: In dev env this works fine, but now that I am getting it ready for production, it isn't working. When I click on it, it converts it to: This prevents The link is constructed using the following. Also, here is the
These variables are supposed to be query parameters in a GET request. When you construct the link, you'll need to have a question mark in there somewhere separating the URL from the query string: The conversion of 这篇关于防止从 URL 中删除等号的 URL 编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!https://test.example.com/auth/security_questions/f=ru&i=101083&k=7014c315f3056243534741610545c8067d64d747a981de22fe75b168a0d
https://test.example.com/auth/security_questions/f%3Dru&i%3D101083&k%3D7014c315f3056243534741610545c8067d64d747a981de22a90d/code/b129025
react-router-dom
匹配正确的 URL,因此 Web 应用程序的一部分无法正确加载.link = '%s/auth/security_questions/f=%s&i=%s&k=%s' % \('https://test.example.com', 'ru', user.id, user.key)
url()
:url(r'^(?:.*)/$', TemplateView.as_view(template_name='index.html')),
https://test.example.com/auth/security_questions/?f=ru&i=101083&k=7014c315...^|___这里
=
到 url 编码的 %3D
等的转换是正确的,等效的.有时变量直接是 URL 的一部分,但在这种情况下,Web 应用程序不使用 & 分隔的键/值对.https://test.example.com/auth/security_questions/f=ru&i=101083&k=7014c315f3056243534741610545c8067d64d747a981de22fe75b78a03d16c92
https://test.example.com/auth/security_questions/f%3Dru&i%3D101083&k%3D7014c315f3056243534741610545c8067d64d747a981de22fe75b78a03d16c92/
react-router-dom
from matching the correct URL, so a portion of the web application does not load properly.link = '%s/auth/security_questions/f=%s&i=%s&k=%s' % \
('https://test.example.com', 'ru', user.id, user.key)
url()
that is catching the route:url(r'^(?:.*)/$', TemplateView.as_view(template_name='index.html')),
https://test.example.com/auth/security_questions/?f=ru&i=101083&k=7014c315...
^
|___ here
=
to url-encoded %3D
etc is correct, and equivalent. Sometimes variables are part of the URL directly, but webapps don't use &-separated key/value pairs in that case.