I had a similar issue, and liked pointed out by @jordanm , the problem got fixed by replacing File.open(url) with URI.open(url)
File.open(url)
URI.open(url)