Check of params (POST request parameter hash) for new image and document
uploads fails when no image or document is uploaded
----------------------------------------------------------------------------------------------------------------------------
Key: OLIO-98
URL: https://issues.apache.org/jira/browse/OLIO-98
Project: Olio
Issue Type: Bug
Components: rails-app
Affects Versions: 0.1
Environment: Rails 2.3.2
Reporter: Hubert Wong
Assignee: Shanti Subramanyam
In Rails 2.3.2, when a blank parameter is sent in a request, the
params[:parameter] is now set to nil instead of the empty string "". When a new
user or event is created without an image or document, the corresponding checks
evaluate to true, resulting in the processing on a new image or document. An
exception is then thrown from this processing and is caught by the controller
resulting in failure.
Patch is as follows (made on 0.1:
Index: users_controller.rb
===================================================================
--- users_controller.rb (revision 776860)
+++ users_controller.rb (working copy)
@@ -223,7 +223,7 @@
private ###################################################
def new_image?
- return (params[:user_image] == '') ? false : true
+ return !(params[:user_image].blank?)
end
def invites_for_friend_links(user)
Index: events_controller.rb
===================================================================
--- events_controller.rb (revision 776860)
+++ events_controller.rb (working copy)
@@ -327,11 +327,11 @@
end
def new_image?
- return (params[:event_image] == '') ? false : true
+ return !(params[:event_image].blank?)
end
def new_document?
- return (params[:event_document] == '') ? false : true
+ return !(params[:event_document].blank?)
end
def attendee_list(event, max)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.