ruby / uri

URI is a module providing classes to handle Uniform Resource Identifiers
https://ruby.github.io/uri/
Other
85 stars 46 forks source link

URI::Parser.new.parse throwing error invalid url that contain $ #92

Open hmfarooq opened 1 year ago

hmfarooq commented 1 year ago

I am parsing url using URI::Parse.new.parse But it's throwing this error

.rvm/gems/ruby-2.7.2/gems/uri-0.13.0/lib/uri/rfc2396_parser.rb:176:insplit': bad URI(is not URI?): https://clk.srv.stackadapt.com/clk?lp=https%3A%2F%2Fwww.selective.com%2Ffor-businesses%2Flanding-pages%2Fpicture-this-agents%3F%26utm_source%3Dstackadapt%26utm_medium%3Dprogrammatic%26utm_campaign%3Dzgm-display-picturethis-clagents%26utm_content%3Drisk-728x90&${SA_APP_NEXUS_CLICK_URL}](https://clk.srv.stackadapt.com/clk?lp=https://www.selective.com/for-businesses/landing-pages/picture-this-agents?&utm_source=stackadapt&utm_medium=programmatic&utm_campaign=zgm-display-picturethis-clagents&utm_content=risk-728x90&$%7BSA_APP_NEXUS_CLICK_URL%7D) (URI::InvalidURIError) `

here is my URL

https://clk.srv.stackadapt.com/clk?lp=https%3A%2F%2Fwww.selective.com%2Ffor-businesses%2Flanding-pages%2Fpicture-this-agents%3F%26utm_source%3Dstackadapt%26utm_medium%3Dprogrammatic%26utm_campaign%3Dzgm-display-picturethis-clagents%26utm_content%3Drisk-728x90&${SA_APP_NEXUS_CLICK_URL}](https://clk.srv.stackadapt.com/clk?lp=https://www.selective.com/for-businesses/landing-pages/picture-this-agents?&utm_source=stackadapt&utm_medium=programmatic&utm_campaign=zgm-display-picturethis-clagents&utm_content=risk-728x90&$%7BSA_APP_NEXUS_CLICK_URL%7D)

mrzasa commented 2 months ago

Dollar sign is a reserved character (https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), so it should be replaced a percent-encoded equivalent.