lib/ctf_party/defang.rb in ctf-party-2.3.0 vs lib/ctf_party/defang.rb in ctf-party-3.0.0
- old
+ new
@@ -78,9 +78,20 @@
uri = URI(self)
rescue URI::InvalidURIError, URI::InvalidComponentError => e
puts e
return gsub('.', '[.]')
end
+ begin
+ # temporary fix until backport for ruby 3.0 https://github.com/ruby/ruby/pull/7260
+ # rubocop:disable Lint/Void
+ URI::WS
+ URI::WSS
+ # rubocop:enable Lint/Void
+ rescue NameError => e
+ puts e
+ require 'uri/ws'
+ require 'uri/wss'
+ end
case uri
when URI::HTTP, URI::HTTPS, URI::FTP
uri.scheme = uri.scheme.gsub(/t/i, 'x')
when URI::WS, URI::WSS
uri.scheme = uri.scheme.dup.insert(1, 'x')