From 06c1f407c7f38998c0881e0758535bcda3a601ca Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 1 May 2016 20:03:22 -1000 Subject: [PATCH] Merge pull request #405 from InnovativeTravel/replace_uri_parse_with_addressable Replace URI parse with Addressable gem --- CHANGELOG.md | 2 ++ app/helpers/react_on_rails_helper.rb | 6 ++++-- react_on_rails.gemspec | 1 + spec/dummy/Gemfile.lock | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afe4ded85..e1aa3afca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. Items under Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version. ## [Unreleased] +##### Changed +- Replace URI with Addressable gem. See [#405](https://github.com/shakacode/react_on_rails/pull/405) by [lucke84] ## [5.2.0] - 2016-04-08 ##### Added diff --git a/app/helpers/react_on_rails_helper.rb b/app/helpers/react_on_rails_helper.rb index 2ea881a63..2636747f4 100644 --- a/app/helpers/react_on_rails_helper.rb +++ b/app/helpers/react_on_rails_helper.rb @@ -358,8 +358,10 @@ def initialize_redux_stores # second parameter passed to both component and store generator functions. def rails_context(server_side:) @rails_context ||= begin - uri = URI.parse(request.original_url) - # uri = URI("http://foo.com:3000/posts?id=30&limit=5#time=1305298413") + # Using Addressable instead of standard URI to better deal with + # non-ASCII characters (see https://github.com/shakacode/react_on_rails/pull/405) + uri = Addressable::URI.parse(request.original_url) + # uri = Addressable::URI.parse("http://foo.com:3000/posts?id=30&limit=5#time=1305298413") result = { # URL settings diff --git a/react_on_rails.gemspec b/react_on_rails.gemspec index 525f554a5..f832019fc 100644 --- a/react_on_rails.gemspec +++ b/react_on_rails.gemspec @@ -24,6 +24,7 @@ Gem::Specification.new do |s| s.add_dependency "rainbow", "~> 2.1" s.add_dependency "rails", ">= 3.2" s.add_dependency "foreman" + s.add_dependency "addressable" s.add_development_dependency "bundler", "~> 1.10" s.add_development_dependency "rake", "~> 10.0" diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock index 0d1ee06c5..92bb4862c 100644 --- a/spec/dummy/Gemfile.lock +++ b/spec/dummy/Gemfile.lock @@ -2,6 +2,7 @@ PATH remote: ../.. specs: react_on_rails (5.2.0) + addressable connection_pool execjs (~> 2.5) foreman @@ -97,7 +98,7 @@ GEM erubis (2.7.0) execjs (2.6.0) ffi (1.9.10) - foreman (0.78.0) + foreman (0.81.0) thor (~> 0.19.1) generator_spec (0.9.3) activesupport (>= 3.0.0)