From f54683464f6ae1d01ef4eb42c175139b6816dbc7 Mon Sep 17 00:00:00 2001 From: Matt Dunn-Rankin Date: Sat, 1 Apr 2017 10:04:54 -0700 Subject: [PATCH] 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 --- app/models/image.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/models/image.rb b/app/models/image.rb index 2cbc6dac..6fd60660 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -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