Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to non-HTTP URI yields NoMethodError #156

Open
michieldewit opened this issue Jul 26, 2024 · 0 comments
Open

Redirect to non-HTTP URI yields NoMethodError #156

michieldewit opened this issue Jul 26, 2024 · 0 comments

Comments

@michieldewit
Copy link
Contributor

When calling the following:

 FastImage.size 'http://world-of-nlp.net/favicon.ico'

This will yields a NoMethodError exception on https://github.com/sdsykes/fastimage/blob/master/lib/fastimage.rb#L301.

The problem is that the original URL leads to a number of redirects, eventually ending at hhttp://www.world-of-nlp.net, which is a valid URI, but not a HTTP URL. As such the URI will get parsed, but it will be parsed to a URI::Generic instance rather than a URI::HTTP instance as FastImage expects when trying to call request_uri on it. Hence the NoMethodError.

It would probably best to add a check like @parsed_uri.is_a? URI::HTTP. Such a check would also be better then checking the scheme property as is being done in initialize().

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

No branches or pull requests

1 participant