This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encode URLs before saving them to the database
Otherwise the notifications will fail with URI::InvalidURIError: bad URI(is not URI?) ``` irb(main):009:0> CASino::ServiceTicket.where('service like "%test%"').first.service CASino::ServiceTicket Load (0.2ms) SELECT `casino_service_tickets`.* FROM `casino_service_tickets` WHERE (service like "%test%") LIMIT 1 => "https://example.org/This is a test/dscn0115.jpg" irb(main):013:0> CASino::ServiceTicket.where('service like "%test%"').first.send(:send_single_sign_out_notification) CASino::ServiceTicket Load (0.4ms) SELECT `casino_service_tickets`.* FROM `casino_service_tickets` WHERE (service like "%test%") LIMIT 1 URI::InvalidURIError: bad URI(is not URI?): https://example.org/This is a test/dscn0115.jpg from /usr/lib/ruby/1.9.1/uri/generic.rb:1202:in `rescue in merge' from /usr/lib/ruby/1.9.1/uri/generic.rb:1199:in `merge' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:303:in `build_exclusive_url' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/faraday-0.8.8/lib/faraday/request.rb:94:in `to_env' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:252:in `run_request' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/faraday-0.8.8/lib/faraday/connection.rb:118:in `post' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/faraday-0.8.8/lib/faraday.rb:24:in `method_missing' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/casino-2.0.2/app/models/casino/service_ticket/single_sign_out_notifier.rb:30:in `send_notification' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/casino-2.0.2/app/models/casino/service_ticket/single_sign_out_notifier.rb:10:in `notify' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/casino-2.0.2/app/models/casino/service_ticket.rb:40:in `send_single_sign_out_notification' from (irb):13 from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/commands/console.rb:47:in `start' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/commands/console.rb:8:in `start' from /home/www-data/sso/shared/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/commands.rb:41:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>' ```
- Loading branch information