myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3286] trunk/app/controllers/blobs_controller.rb:


From: noreply
Subject: [myexperiment-hackers] [3286] trunk/app/controllers/blobs_controller.rb: Fix for nil content_type when uploading a file with an unrecognized type
Date: Mon, 7 Jan 2013 08:40:09 +0000 (UTC)

Revision
3286
Author
fbacall
Date
2013-01-07 08:40:08 +0000 (Mon, 07 Jan 2013)

Log Message

Fix for nil content_type when uploading a file with an unrecognized type

Modified Paths

Diff

Modified: trunk/app/controllers/blobs_controller.rb (3285 => 3286)


--- trunk/app/controllers/blobs_controller.rb	2013-01-04 13:00:51 UTC (rev 3285)
+++ trunk/app/controllers/blobs_controller.rb	2013-01-07 08:40:08 UTC (rev 3286)
@@ -148,7 +148,10 @@
       @blob = Blob.new(params[:blob])
       @blob.content_blob = ContentBlob.new(:data ="" data)
 
-      @blob.content_type = ContentType.find_or_create_by_mime_type(:user => current_user, :mime_type => content_type, :category=> 'Blob')
+      @blob.content_type = ContentType.find_or_create_by_mime_type(:user => current_user,
+                                                                   :title => content_type,
+                                                                   :mime_type => content_type,
+                                                                   :category=> 'Blob')
 
       respond_to do |format|
         if @blob.save
@@ -211,7 +214,10 @@
     if params[:blob][:data] && params[:blob][:data].size > 0
       @blob.build_content_blob(:data ="" params[:blob][:data].read)
       @blob.local_name = params[:blob][:data].original_filename
-      @blob.content_type = ContentType.find_or_create_by_mime_type(:user => current_user, :title => params[:blob][:data].content_type, :mime_type => params[:blob][:data].content_type, :category => 'Blob')
+      @blob.content_type = ContentType.find_or_create_by_mime_type(:user => current_user,
+                                                                   :title => params[:blob][:data].content_type,
+                                                                   :mime_type => params[:blob][:data].content_type,
+                                                                   :category => 'Blob')
     end
 
     params[:blob].delete(:data)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]