File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -146,11 +146,11 @@ def opts_from_url(url)
146146
147147 def opts_from_non_params ( url )
148148 { } . tap do |o |
149- o [ :host ] = url . host if url . host
150- o [ :port ] = url . port if url . port
151- o [ :username ] = url . user if url . user
152- o [ :password ] = url . password if url . password
153- o [ :database ] = url . path [ 1 ..-1 ] if url . path . length > 1
149+ o [ :host ] = url . host if url . host
150+ o [ :port ] = url . port if url . port
151+ o [ :username ] = URI . decode_www_form_component ( url . user ) if url . user
152+ o [ :password ] = URI . decode_www_form_component ( url . password ) if url . password
153+ o [ :database ] = url . path [ 1 ..-1 ] if url . path . length > 1
154154 o [ :use_ssl ] = url . scheme == "https" . freeze
155155
156156 o [ :udp ] = { host : o [ :host ] , port : o [ :port ] } if url . scheme == "udp"
Original file line number Diff line number Diff line change 162162 expect ( conf ) . not_to be_async
163163 end
164164
165+ context "with encoded values" do
166+ let ( :url ) { "https://weird%24user:weird%25pass@influx.example.com:8765/testdb" }
167+
168+ it "decode encoded values" do
169+ expect ( conf . username ) . to eq "weird$user"
170+ expect ( conf . password ) . to eq "weird%pass"
171+ end
172+ end
173+
165174 context "UDP" do
166175 let ( :url ) { "udp://test.localhost:2345?discard_write_errors=1" }
167176 specify { expect ( conf ) . to be_udp }
You can’t perform that action at this time.
0 commit comments