stop appending ?NO_CAMO_CONFIG when image proxying is disabled

One time I did a thing called Camo to try to get our HTTPS pages working,
because images.neopets.com not supporting HTTPS is crazy >_> I've diasbled it
these days, but it had debug behavior to append `?NO_CAMO_CONFIG` to all
proxied URLs when Camo was not configured.

When an item had no thumbnail URL for some reason (mall spider needs fixing,
maybe?), this caused Rails to try to map that empty string into the path
`/assets/?NO_CAMO_CONFIG`, which made Rails complain that it was trying to load
an asset that doesn't exist. This is probably a sign that using `image_tag` for
URLs that *should* be external URLs, but aren't strictly *guaranteed* to be, is
unwise - but, for now, I've just disabled that behavior. I hope Rails has a
better escape hatch for the empty string :P
This commit is contained in:
Matt Dunn-Rankin 2017-04-01 10:04:54 -07:00
parent 512b64a104
commit f54683464f

View file

@ -19,10 +19,7 @@ class Image
uri.query_values = { url: insecure_url }
uri.to_s
else
uri = Addressable::URI.parse(insecure_url)
query_values = uri.query_values || {}
uri.query_values = query_values.merge(NO_CAMO_CONFIG: nil)
uri.to_s
insecure_url
end
end
end