Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- `FormData::File` raised `NameError` on Ruby 3.4 and older when nothing
else had loaded Pathname, for example with `--disable-gems`.

## [3.0.1] - 2026-03-20

### Changed
Expand Down
2 changes: 2 additions & 0 deletions lib/http/form_data/file.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "pathname"

module HTTP
module FormData
# Represents file form param.
Expand Down
9 changes: 9 additions & 0 deletions test/http/form_data/file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ def each_source

public

# Pathname is only part of core Ruby from 4.0, and RubyGems usually
# loads it, so this checks in a process without RubyGems.
def test_loads_without_rubygems
lib = File.expand_path("../../../lib", __dir__)
code = 'require "stringio"; require "http/form_data"; HTTP::FormData::File.new(StringIO.new("x"))'

assert system({ "RUBYOPT" => nil }, RbConfig.ruby, "--disable-gems", "-I", lib, "-e", code, err: File::NULL)
end

# --- Core Readable behavior across IO sources ---

def test_size
Expand Down
Loading