Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Check for referer before attempting to parse as URI

  • Loading branch information...
commit 6ebc9a6264a193039ebc1ac03dabdff46eeccbd6 1 parent 2025d97
@radar radar authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 core/app/controllers/spree/products_controller.rb
View
9 core/app/controllers/spree/products_controller.rb
@@ -18,9 +18,12 @@ def show
@variants = Variant.active.includes([:option_values, :images]).where(:product_id => @product.id)
@product_properties = ProductProperty.includes(:property).where(:product_id => @product.id)
- referer_path = URI.parse(request.env['HTTP_REFERER']).path
- if referer_path && referer_path.match(/\/t\/(.*)/)
- @taxon = Taxon.find_by_permalink($1)
+ referer = request.env['HTTP_REFERER']
+ if referer
+ referer_path = URI.parse(request.env['HTTP_REFERER']).path
+ if referer_path && referer_path.match(/\/t\/(.*)/)
+ @taxon = Taxon.find_by_permalink($1)
+ end
end
respond_with(@product)
Please sign in to comment.
Something went wrong with that request. Please try again.