Repository navigation
Description
Image.open takes a path; MiniMagick's takes a path or a URL
Found while settling #950's Images half by reading the reference. go-ruby-images' README calls itself "a MiniMagick / ruby-vips replacement", and MiniMagick's lib/mini_magick/image.rb is:
def self.open(path_or_url, ext = nil, **options)
if path_or_url.to_s =~ %r{\A(https?|ftp)://}
uri = URI(path_or_url)
ext ||= File.extname(uri.path).sub(/:.*/, '')
uri.open(options) { |file| read(file, ext) }
else
pathname = Pathname(path_or_url)
ext ||= File.extname(pathname.to_s)
pathname.open(binmode: true, **options) { |file| read(file, ext) }
end
endrbgo's (internal/vm/images.go) decodes a file and nothing else:
imagesArity(args, 1)
return imagesWrap(images.Open(strArg(args[0])))so Images::Image.open("https://example.org/photo.png") raises Images::Error on a file that is not there, where MiniMagick fetches it.
⛔ This is filed, not fixed, because implementing it is a security decision
Making it work means the interpreter performs an outbound HTTP/FTP request driven by an argument that looks like a path. Any program that passes a user-supplied string to Image.open — which reads as a filesystem operation — would acquire a request-forgery surface it did not ask for. MiniMagick has that property; whether rbgo should inherit it is a judgement for the maintainer, not a parity checkbox.
Three options, no recommendation:
- Implement it, matching MiniMagick, and document the fetch. The scheme set would be
https?|ftpto match;ftpin particular is worth questioning on its own. - Refuse it loudly — detect the
\A(https?|ftp)://shape and raise with a message saying rbgo'sImage.openis filesystem-only, so the divergence is named at the call site instead of surfacing as a confusing "no such file". - Leave it and record the divergence in the README's table.
Option 2 is the only one that costs nothing and removes the confusing failure, but it is still a behaviour change and still the maintainer's call.
What is NOT part of this
- The block form: settled, not a gap. MiniMagick's
opentakes no block, so rbgo discarding one is correct — see Images::Image.open discards its block and has no known reference — the Augeas half was never blocked, see #952 #950 and its PR. - The
extargument: MiniMagick takesext = niland rbgo ignores a second argument (imagesArityis a minimum, so it is silently accepted rather than refused). Cosmetic: go-ruby-images'Opencallsimage.Decode, which sniffs the format from the content through the registered PNG/JPEG/GIF/BMP/TIFF/WebP decoders, so the hint changes nothing on either side. Noted here so the next reader does not re-derive it; not worth its own issue. **options: forwarded toPathname#open/URI#openin MiniMagick. Out of scope until someone wants a specific one.
Refs #950 — settled by its own PR; this is the separate divergence that reading the same reference turned up.
🤖 Generated with Claude Code
Prior art: priorart "Images::Image.open does not accept an http or ftp URL where MiniMagick fetches it" at 2026-11-17 13:37 CET reported prior art; checked: The 680 hits are keyword matches on images/open/accept/http across the tracker: #950 is the block-form question this PR settles, #931/#932/#935/#916 are the socket doors and the network hangs, #951/#952 the door ratchet and Augeas, #867/#497 Renovate. None is about Image.open's ARGUMENT accepting a URL. Nothing covers this.
Activity
vm(images): Image.open takes no block, and wiring one would call a fi…