Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep this gem available with Ruby 3.1 #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

takuminmin-m
Copy link

Hi there,

Thanks for this nice gem to use carrierwave-data-uri.

I noticed require "data_uri" fails when I upgraded my application to Ruby3.1.
Look like we mustn't use @@schemes class variable because the suparclass "URI::Generic" has been changed the specification.(the relevant PR is here).

If you have any advices, please tell me.
Hope that helps!

@@ -61,6 +61,6 @@ def self.build(arg)
end
end

@@schemes['DATA'] = Data
scheme_list['DATA'] = Data

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this new improvement could also be used?
ruby/uri@4346daa

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a Rails initializer with this content, which worked for me:

require 'data_uri'
require 'data_uri/open_uri'

URI.register_scheme('DATA', URI::Data)

mamhoff added a commit to friendlycart/friendly_shipping that referenced this pull request Sep 15, 2022
The URI gem has changed its public API with this version, breaking
compatibility with the largely unmaintained `data_uri` gem. This fixes
the co-dependency issue for now; once this PR in `data_uri` is merged we
can update to the newest `uri` gem:

dball/data_uri#10
@@ -61,6 +61,6 @@ def self.build(arg)
end
end

@@schemes['DATA'] = Data
scheme_list['DATA'] = Data
Copy link

@haseebeqx haseebeqx Jan 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend to do this to make it available for older versions of ruby. also used https://ruby-doc.org/stdlib-3.1.0/libdoc/uri/rdoc/URI.html#method-c-register_scheme

unless defined?(self.register_scheme)
  def self.register_scheme(scheme, klass)
     @@schemes[scheme] = klass
  end
end
register_scheme 'DATA', Data

@PikachuEXE
Copy link

Should we ping contributors individually to see if this can be merged? Or even if this gem is maintained?

@PikachuEXE
Copy link

@dball ?

@PikachuEXE
Copy link

@dball

A fix for a CVE is released

CVE-2023-36617: ReDoS vulnerability in URI

Eventually uri 0.10.x will become unmaintained and this should be addressed soon
Add people as maintainers if you don't the capacity to maintain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants