Keep this gem available with Ruby 3.1#10
Conversation
| end | ||
|
|
||
| @@schemes['DATA'] = Data | ||
| scheme_list['DATA'] = Data |
There was a problem hiding this comment.
Perhaps this new improvement could also be used?
ruby/uri@4346daa
There was a problem hiding this comment.
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)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
| end | ||
|
|
||
| @@schemes['DATA'] = Data | ||
| scheme_list['DATA'] = Data |
There was a problem hiding this comment.
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|
Should we ping contributors individually to see if this can be merged? Or even if this gem is maintained? |
|
@dball ? |
|
A fix for a CVE is released CVE-2023-36617: ReDoS vulnerability in URI Eventually |
|
Can we please get this merged? |
|
Released a beta |
It seems that the source code for it is available at https://github.com/data-uri-ruby/data_uri/tree/master/lib I note that the In order to make the distributed gem work, I added that snippet to my Rails initializer: require "data_uri_revived"
require "stringio"
module URI
class Data
def open
io = StringIO.new(data)
OpenURI::Meta.init(io)
io.meta_add_field("content-type", content_type)
if block_given?
begin
yield io
ensure
io.close
end
else
io
end
end
end
end
URI.register_scheme("DATA", URI::Data)Hope this helps! |
|
Ya I removed that part since I have no idea what it does and how people use it |
|
https://github.com/data-uri-ruby/data_uri got https://github.com/data-uri-ruby/data_uri/releases/tag/v0.1.1 a year ago |
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
@@schemesclass 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!