public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
[#73] Fixed photo upload cancellation
Michael Hartl (author)
Sun May 18 10:01:16 -0700 2008
commit  fd536d6265c47c3130992296234bafffa717e0a8
tree    dec922958941ebec3e10e4f2f659df82845d5cf6
parent  e1fd8b8e440c9f3ab34161d4e87de78e956c1012
...
28
29
30
31
32
33
 
 
 
 
 
34
35
36
...
28
29
30
 
 
 
31
32
33
34
35
36
37
38
0
@@ -28,9 +28,11 @@ class PhotosController < ApplicationController
0
 
0
   def create
0
     if params[:photo].nil?
0
- unless params[:commit] == "Cancel"
0
- flash[:error] = "Your browser doesn't appear to support file uploading"
0
- end
0
+ # This is mainly to prevent exceptions on iPhones.
0
+ flash[:error] = "Your browser doesn't appear to support file uploading"
0
+ redirect_to edit_person_url(current_person) and return
0
+ end
0
+ if params[:commit] == "Cancel"
0
       redirect_to edit_person_url(current_person) and return
0
     end
0
     person_data = { :person => current_person,
...
57
58
59
60
 
61
62
63
...
57
58
59
 
60
61
62
63
0
@@ -57,7 +57,7 @@ describe PhotosController do
0
     end
0
     
0
     it "should handle cancellation and doesn't report about problem" do
0
- post :create, :commit => "Cancel"
0
+ post :create, :commit => "Cancel", :photo => { :uploaded_data => nil }
0
       response.should redirect_to(edit_person_url(@person))
0
       flash[:error].should be_nil
0
     end

Comments

    No one has commented yet.