Skip to content

Conversation

@jules-w2
Copy link
Contributor

@jules-w2 jules-w2 commented Jan 8, 2026

Summary

  • Replace CGI.parse with URI.decode_www_form in ResumableSession
  • Remove unused require 'cgi'

Context

Ruby 4.0 removed the cgi library from the standard library. Only cgi/escape remains available for basic escaping methods. This causes the following error when uploading videos: undefined method 'parse' for class CGI

Solution

Use URI.decode_www_form which is part of Ruby's core URI library and provides identical functionality. This is the recommended replacement per Ruby documentation.

Before:

CGI::parse(@uri.query).tap{|hash| hash.each{|k,v| hash[k] = v.first}}

After:

URI.decode_www_form(@uri.query || "").to_h

Testing
This change is backwards compatible with Ruby 3.x as URI.decode_www_form has been available since Ruby 1.9.2.

….0 compatibility

Ruby 4.0 removed CGI.parse from the standard library. Use URI.decode_www_form instead,
which is part of the core URI library and provides identical functionality.
@kangkyu
Copy link
Contributor

kangkyu commented Jan 8, 2026

Thank you for contributing

@kangkyu kangkyu self-requested a review January 8, 2026 17:50
@kangkyu kangkyu merged commit 605a303 into nullscreen:master Jan 8, 2026
3 checks passed
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.

2 participants