如何cgi转义ruby凭证

Sam*_*tha 6 ruby

我正在运行命令捆绑安装并不断收到以下错误

Please CGI escape your usernames and passwords before setting them for authentication.

我不确定如何让 CGI 转义我的凭据 - 有什么想法吗?谢谢

Sim*_*mon 5

您可以irb使用 Ruby 的CGI::Util模块来完成此操作:

$ irb
irb(main):001:0> require "cgi"
=> true
irb(main):002:0> CGI.escape "foo@example.com"
=> "foo%40example.com"

Run Code Online (Sandbox Code Playgroud)