Closed maia closed 4 years ago
Seems to work for me with v3.4.0
:
r = LinkThumbnailer.generate('https://www.90minuten.at/de/red/magazin/reportage/2017/juni/special-violets--vom-schuhe-binden-und-grenzen-ueberwinden');nil
r.t => nil
2.6.6 :014 > r.title
=> "Special Violets: Vom Schuhe binden und Grenzen überwinden (90minuten.at)"
Currently the method
perform_request
inlink_thumbnailer/lib/link_thumbnailer/processor.rb
will callvalid_response_format?
before following a redirect. This has the effect that it will returnLinkThumbnailer::FormatNotSupported
as soon as a single response on the way through all the redirects is not a valid response format, e.g. if it's empty.I suggest to move
raise ::LinkThumbnailer::FormatNotSupported.new(response['Content-Type']) unless valid_response_format?(response)
into the case statementwhen ::Net::HTTPSuccess
.As an example:
https://www.90minuten.at/de/red/magazin/reportage/2017/juni/special-violets--vom-schuhe-binden-und-grenzen-ueberwinden
hasresponse['Content-Type']: text/html; charset=utf-8
and redirects to:http://www.90minuten.at/de/red/magazin/reportage/2017/juni/special-violets--vom-schuhe-binden-und-grenzen-ueberwinden/
. This url has an emptyresponse['Content-Type']
but redirects tohttps://www.90minuten.at/de/red/magazin/reportage/2017/juni/special-violets--vom-schuhe-binden-und-grenzen-ueberwinden/
withresponse['Content-Type']: text/html; charset=utf-8
. As LinkThumbnailer stops at the second url, it does not manage to return an object with information about that url.