Fix 404 handling for endpoints matching short URLs

This commit is contained in:
Omar Roth 2019-06-07 12:42:07 -05:00
parent 27e032d10d
commit f065a21542
No known key found for this signature in database
GPG key ID: B8254FB7EC3D37F2

View file

@ -5058,6 +5058,11 @@ error 404 do |env|
response = client.get(response.headers["Location"])
end
if response.body.empty?
env.response.headers["Location"] = "/"
halt env, status_code: 302
end
html = XML.parse_html(response.body)
ucid = html.xpath_node(%q(//meta[@itemprop="channelId"]))