[open-uri] cannot parse correctly a file with a dot inside the filename

I have some big issue in opening one file …

currently I am writing

require ‘open-uri’

io = open(URI.parse(thumbnail_url))
def io.original_filename; base_uri.path.split(’/’).last; end
io.original_filename.blank? ? nil : io

this one ( and similar) open very well
thumbnail_url = “http://video.vertexdigitalsports.com//sitehome/site41/
userUpload/ID7bcfa7ff-63d0-4564-ad22-5c7a233d4890/
JoeFBVideo2328_thumbnail.png”

I get
#<File:/var/folders/NK/NKfWCW3eEVCg0ERnpPsnME+++TI/-Tmp-/open-
uri20110614-5150-1frj7ah>

but trying to open this one … ( there is a dot in the filename …
thumbnail_url = “http://video.vertexdigitalsports.com//sitehome/site41/
userUpload/ID856657ea-1f86-4937-904c-04852ca94ad1/
PerformanceManagementVideoVer1.32430_thumbnail.png”

I get
#StringIO:0x0000010702e15 and this raises an exception in my app…

I tried to use 'addressable/uri)

require ‘addressable/uri’
uri = Addressable::URI.parse(thumbnail_url)
open(uri.normalize.to_s) {|f| p f.status } => [“200”, “OK”]
then
io = open(uri.normalize.to_s) {|f| f.read }
but this is not right …

what should I rather write ?

thanks for your feedback

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs