Skip to content

Commit

Permalink
Check for referer before attempting to parse as URI
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Jul 26, 2012
1 parent 2025d97 commit 6ebc9a6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/app/controllers/spree/products_controller.rb
Expand Up @@ -18,9 +18,12 @@ def show
@variants = Variant.active.includes([:option_values, :images]).where(:product_id => @product.id) @variants = Variant.active.includes([:option_values, :images]).where(:product_id => @product.id)
@product_properties = ProductProperty.includes(:property).where(:product_id => @product.id) @product_properties = ProductProperty.includes(:property).where(:product_id => @product.id)


referer_path = URI.parse(request.env['HTTP_REFERER']).path referer = request.env['HTTP_REFERER']
if referer_path && referer_path.match(/\/t\/(.*)/) if referer
@taxon = Taxon.find_by_permalink($1) referer_path = URI.parse(request.env['HTTP_REFERER']).path
if referer_path && referer_path.match(/\/t\/(.*)/)
@taxon = Taxon.find_by_permalink($1)
end
end end


respond_with(@product) respond_with(@product)
Expand Down

0 comments on commit 6ebc9a6

Please sign in to comment.