Shopify / omniauth-shopify-oauth2

Shopify OAuth2 Strategy for OmniAuth 1.0
http://shopify.github.io/omniauth-shopify-oauth2
91 stars 69 forks source link

Handle immutable strings in the omniauth.rb file #54

Closed JoePym closed 7 years ago

JoePym commented 7 years ago

@EiNSTeiN- @Hammadk

If you have an omniauth.rb file using the new # frozen_string_literal: true (in preparation for Ruby 3) that looks something like:

# frozen_string_literal: true
shopify_setup = lambda do |env|
   request = Rack::Request.new(env)
   ....
  env['omniauth.strategy'].options[:client_options][:site] = 'https://someshopurl.com'
  ...

then the gsub that's present in the strategy file will cause exceptions on the frozen string. This PR creates a copy of the string instead so that it doesn't care whether the input is frozen.