为什么当我使用重定向的URL时,%20会变成%2520? [英] Why does %20 become %2520 when I use a redirected url?

查看:523
本文介绍了为什么当我使用重定向的URL时,%20会变成%2520?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://terraref.ncsa.illinois.edu/bety/api/v1/search.json?sitename=~Season%204&limit=1

这不是

当我使用基本网址terraref.org而不是terraref.ncsa.illinois.edu时:

this does not

when I use the base url terraref.org rather than terraref.ncsa.illinois.edu:

https://terraref.org/bety/api/v1/search.json?sitename=~Season%204&limit=1

因为在第二种情况下,%%25替换,然后找不到查询项.

because in this second case the % is replaced by %25 and the query term is then not found.

  • 我该如何解决?
  • 为什么这在最近几个月出现了?

您可以看到与我使用的R软件包有关的红色鲱鱼的问题历史记录 多亏了这些评论,我认为问题已经缩小了

you can see question history for the red herring related to the R packages I was using thanks to the comments, I've narrowed down the issue, I think

我包含了ruby-on-rails和nginx标签,因为这些是api和服务器使用的工具.

I've included tags ruby-on-rails and nginx because these are the tools that the api and server are using.

推荐答案

检查Chrome DevTools以调试问题.

Check Chrome DevTools to debug the problem.

正在使用以下查询参数重定向您的呼叫.

Your call is being redirected with the following query parameters.

sitename: ~Season 4
limit: 1

如果选择编码视图,您将看到罪魁祸首.

If you choose the encoded view, you'll see the culprit.

因此,正如人们可能期望的那样,它就像双重URL编码一样简单.

So, as one might expect, it's just as simple as double url encoding.

如果您需要使用terraref.org作为基本网址,请用加号替换空格.

If you need to use terraref.org as a base url, replace space with a plus.

https://terraref.org/bety/api/v1/search.json?sitename=~Season+4&limit=1

这篇关于为什么当我使用重定向的URL时,%20会变成%2520?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆