Issue 96: PATCH The system crashes when passing an invalid tag in the front face site.
Status:  Fixed
Owner: ----
Closed:  Jun 2008
Reported by edmundo...@gmail.com, Jun 9, 2008
What steps will reproduce the problem?
1. Enter an URL that have an invalid tag at the address bar. i.e.
http://localhost:3000/store/show_by_tags/invalid

What is the expected output? What do you see instead?
It should handle it gracefully. It crashes with an
ActiveRecord::StatementInvalid exception.

What version of the product are you using? On what operating system?
trunk. Ubuntu 7.10

Please provide any additional information below.
The show_by_tags method don't validate the data after trying to get it from
the database. Even when empty it tries to use it.

Now, if any tag or subtag is not found, it redirects to index with a flash
message indicating the problem tag.
dont_crash_with_invalid_tag.patch
811 bytes   View   Download
Jun 10, 2008
#1 patrickb...@gmail.com
This is not a complete fix. Navigate to:

http://localhost:3000/store/show_by_tags/

--or--

http://localhost:3000/store/show_by_tags

Jun 10, 2008
#2 patrickb...@gmail.com
if @tag_names.empty?
      redirect_to :controller => 'homepage', :action => 'index' and return false
    else
		  for name in @tag_names
		  	temp_tag = Tag.find_by_name(name)
		  	if temp_tag then
		  		tag_ids_array << temp_tag.id
		  	else
          flash[:notice] = "Sorry, we couldn't find the tag #{name} you were looking
for."
          redirect_to :controller => 'homepage', :action => 'index' and return false
        end
		  end
    end
Jun 10, 2008
#3 edmundo...@gmail.com
thanks. fixed.
dont_crash_with_invalid_tag_v2.patch
1.2 KB   View   Download
Jun 14, 2008
Project Member #4 subim...@gmail.com
Thanks for the heads up. Fixed in r91, but instead of using a flash I'm rendering a 404 page, which is the 
expected behavior for things of this nature.

No reason to reinvent the wheel ;)
Status: Fixed