Infinite Log with PaperClip and Ruby on Rails -
i got big weird issue when upload file, posted bug/issue on official git page: https://github.com/thoughtbot/paperclip/issues/1938
as press submit button of form, 5 min loop of logs console started rail server
.
here my model:
class ship < activerecord::base belongs_to :user has_many :users, through: :votes has_many :users, through: :comments has_attached_file :shipimage, #:styles => { :thumb=> "100x100#", :small => ["150x150>", :jpg] }, :default_url => "/images/shipimages/missing_:style.png", :url => "/images/shipimages/:id_:style_:basename.:extension" #validates_attachment_presence :shipimage validates_attachment_content_type :shipimage, :content_type => [ "image/jpg", "image/jpeg", "image/png" ] # validates_attachment :image, presence: true, # content_type: { content_type: ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'] }, # size: { less_than: 5.megabytes } has_attached_file :shipfile, :url => "/ships/:id_:basename.:extension" #validates_attachment_presence :shipfile validates_attachment_file_name :shipfile, :matches => [/lua\z/] end
here my db:
class createships < activerecord::migration def change create_table :ships |t| t.string :name t.integer :points t.attachment :shipimage t.attachment :shipfile t.references :user t.timestamps end end end
here my controller:
class shipscontroller < applicationcontroller before_action :require_user, only: [:new, :create] before_action :require_admin, only: [:delete, :update] def index @ships = ship.all end def show @ship = ship.find(params[:id]) end def new @ship = ship.new end def create @ship = ship.new(ship_params) @ship.user = current_user if @ship.save redirect_to(:action => 'show', :id => @ship.id) else render 'new' end end def destroy @ship = ship.find(params[:id]) @ship.destroy redirect_to '/'#root_url end private def ship_params params.require(:ship).permit(:name, :points, :shipimage, :shipfile) end end
and here my view:
<div class="ship_new"> <div class="form"> <h1>upload ship</h1> <%= form_for @ship, :html => { :multipart => true } |f| %> <p><%= f.text_field :name, :placeholder => "name" %></p> <p><%= f.number_field :points, :placeholder => "points" %></p> <p><%= f.label :shipimage , "image" %> <%= f.file_field :shipimage %></p> <p><%= f.label :shipfile , "ship file" %> <%= f.file_field :shipfile %></p> <p><%= f.submit "upload ship", class: "btn-submit" %></p> <% end %> </div> </div>
the logs
lication/cybercash", @raw_media_type="application", @raw_sub_type="cybercash", @simplified="application/cybercash", @i18n_key="application.cybercash", @media_type="application", @sub_type="cybercash", @extensions=[]>], "application/dash+xml"=>[#<mime::type::columnar:0x359d300 @container=#<mime::type s:0x36d7d48 ...>, @content_type="application/dash+xml", @raw_media_type="application", @raw_sub_type="dash+xml", @simplified="application/dash+xml", @ i18n_key="application.dash-xml", @media_type="application", @sub_type="dash+xml", @extensions=[]>], "application/dashdelta"=>[#<mime::type::columnar:0 x3596aa8 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/dashdelta", @raw_media_type="application", @raw_sub_type="dashdelta", @si mplified="application/dashdelta", @i18n_key="application.dashdelta", @media_type="application", @sub_type="dashdelta", @extensions=[]>], "application/ davmount+xml"=>[#<mime::type::columnar:0x3594fc0 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/davmount+xml", @raw_media_type="a pplication", @raw_sub_type="davmount+xml", @simplified="application/davmount+xml", @i18n_key="application.davmount-xml", @media_type="application", @s ub_type="davmount+xml", @extensions=["davmount"]>], "application/dca-rft"=>[#<mime::type::columnar:0x35944f8 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/dca-rft", @raw_media_type="application", @raw_sub_type="dca-rft", @simplified="application/dca-rft", @i18n_key="application .dca-rft", @media_type="application", @sub_type="dca-rft", @extensions=[]>], "application/dcd"=>[#<mime::type::columnar:0x358fc50 @container=#<mime::t ypes:0x36d7d48 ...>, @content_type="application/dcd", @raw_media_type="application", @raw_sub_type="dcd", @simplified="application/dcd", @i18n_key="ap plication.dcd", @media_type="application", @sub_type="dcd", @extensions=[]>], "application/dec-dx"=>[#<mime::type::columnar:0x358f5f0 @container=#<mim e::types:0x36d7d48 ...>, @content_type="application/dec-dx", @raw_media_type="application", @raw_sub_type="dec-dx", @simplified="application/dec-dx", @i18n_key="application.dec-dx", @media_type="application", @sub_type="dec-dx", @extensions=[]>], "application/dialog-info+xml"=>[#<mime::type::columna r:0x358ee70 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/dialog-info+xml", @raw_media_type="application", @raw_sub_type="dialog -info+xml", @simplified="application/dialog-info+xml", @i18n_key="application.dialog-info-xml", @media_type="application", @sub_type="dialog-info+xml" , @extensions=[]>], "application/dicom"=>[#<mime::type::columnar:0x358e7e0 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/dicom", @raw_media_type="application", @raw_sub_type="dicom", @simplified="application/dicom", @i18n_key="application.dicom", @media_type="application", @sub _type="dicom", @extensions=["dcm"]>], "application/dii"=>[#<mime::type::columnar:0x358da30 @container=#<mime::types:0x36d7d48 ...>, @content_type="app lication/dii", @raw_media_type="application", @raw_sub_type="dii", @simplified="application/dii", @i18n_key="application.dii", @media_type="applicatio n", @sub_type="dii", @extensions=[]>], "application/dit"=>[#<mime::type::columnar:0x358ce30 @container=#<mime::types:0x36d7d48 ...>, @content_type="ap plication/dit", @raw_media_type="application", @raw_sub_type="dit", @simplified="application/dit", @i18n_key="application.dit", @media_type="applicati on", @sub_type="dit", @extensions=[]>], "application/dns"=>[#<mime::type::columnar:0x358c428 @container=#<mime::types:0x36d7d48 ...>, @content_type="a pplication/dns", @raw_media_type="application", @raw_sub_type="dns", @simplified="application/dns", @i18n_key="application.dns", @media_type="applicat ion", @sub_type="dns", @extensions=[]>], "application/docbook+xml"=>[#<mime::type::columnar:0x3587c58 @container=#<mime::types:0x36d7d48 ...>, @conten t_type="application/docbook+xml", @raw_media_type="application", @raw_sub_type="docbook+xml", @simplified="application/docbook+xml", @i18n_key="applic ation.docbook-xml", @media_type="application", @sub_type="docbook+xml", @extensions=["dbk"]>], "application/drafting"=>[#<mime::type::columnar:0x3586a 58 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/drafting", @raw_media_type="application", @raw_sub_type="drafting", @simplified ="application/drafting", @i18n_key="application.drafting", @media_type="application", @sub_type="drafting", @extensions=[]>, #<mime::type::columnar:0x 48e0d60 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/x-drafting", @raw_media_type="application", @raw_sub_type="x-drafting", @s implified="application/drafting", @i18n_key="application.drafting", @media_type="application", @sub_type="drafting", @extensions=[]>], "application/ds kpp+xml"=>[#<mime::type::columnar:0x3585ab0 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/dskpp+xml", @raw_media_type="applicati on", @raw_sub_type="dskpp+xml", @simplified="application/dskpp+xml", @i18n_key="application.dskpp-xml", @media_type="application", @sub_type="dskpp+xm l", @extensions=[]>], "application/dssc+der"=>[#<mime::type::columnar:0x3584ec8 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/ds sc+der", @raw_media_type="application", @raw_sub_type="dssc+der", @simplified="application/dssc+der", @i18n_key="application.dssc-der", @media_type="a pplication", @sub_type="dssc+der", @extensions=["dssc"]>], "application/dssc+xml"=>[#<mime::type::columnar:0x35841f0 @container=#<mime::types:0x36d7d4 8 ...>, @content_type="application/dssc+xml", @raw_media_type="application", @raw_sub_type="dssc+xml", @simplified="application/dssc+xml", @i18n_key=" application.dssc-xml", @media_type="application", @sub_type="dssc+xml", @extensions=["xdssc"]>], "application/dvcs"=>[#<mime::type::columnar:0x3577818 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/dvcs", @raw_media_type="application", @raw_sub_type="dvcs", @simplified="applicat ion/dvcs", @i18n_key="application.dvcs", @media_type="application", @sub_type="dvcs", @extensions=[]>], "application/dxf"=>[#<mime::type::columnar:0x3 576648 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/dxf", @raw_media_type="application", @raw_sub_type="dxf", @simplified="appl ication/dxf", @i18n_key="application.dxf", @media_type="application", @sub_type="dxf", @extensions=[]>, #<mime::type::columnar:0x48eb410 @container=#< mime::types:0x36d7d48 ...>, @content_type="application/x-dxf", @raw_media_type="application", @raw_sub_type="x-dxf", @simplified="application/dxf", @i 18n_key="application.dxf", @media_type="application", @sub_type="dxf", @extensions=[]>], "application/ecmascript"=>[#<mime::type::columnar:0x3574470 @ container=#<mime::types:0x36d7d48 ...>, @content_type="application/ecmascript", @raw_media_type="application", @raw_sub_type="ecmascript", @simplified ="application/ecmascript", @i18n_key="application.ecmascript", @media_type="application", @sub_type="ecmascript", @extensions=["ecma"]>], "application /edi-consent"=>[#<mime::type::columnar:0x356b608 @container=#<mime::types:0x36d7d48 ...>, @content_type="application/edi-consent", @raw_media_type="ap plication", @raw_sub_type="edi-consent", @simplified="application/edi-consent", @i18n_key="application.edi-consent", @media_type="application", @sub_t ype="edi-consent", @extensions=[]>], "application/edi-x12"=>[#<mime::type::columnar:0x356a450 @container=#<mime::types:0x36d7d48 ...>, @content_type="
i pages , pages of going on in console start rails server , stops after few minutes. happens no matter file uploading...
here end of log: ed="video/smv", @i18n_key="video.smv", @media_type="video", @sub_type="smv", @extensions=["smv"]>, #<mime::type::columnar:0x4b03480 @container=#<mime: :types:0x4a32d70 ...>, @content_type="x-chemical/x-pdb", @raw_media_type="x-chemical", @raw_sub_type="x-pdb", @simplified="chemical/pdb", @i18n_key="c hemical.pdb", @media_type="chemical", @sub_type="pdb", @extensions=["pdb"]>, #<mime::type::columnar:0x4b02c88 @container=#<mime::types:0x4a32d70 ...>, @content_type="x-chemical/x-xyz", @raw_media_type="x-chemical", @raw_sub_type="x-xyz", @simplified="chemical/xyz", @i18n_key="chemical.xyz", @media_t ype="chemical", @sub_type="xyz", @extensions=["xyz"]>, #<mime::type::columnar:0x4b024a8 @container=#<mime::types:0x4a32d70 ...>, @content_type="x-conf erence/x-cooltalk", @raw_media_type="x-conference", @raw_sub_type="x-cooltalk", @simplified="conference/cooltalk", @i18n_key="conference.cooltalk", @m edia_type="conference", @sub_type="cooltalk", @extensions=["ice"]>, #<mime::type::columnar:0x4b01cc8 @container=#<mime::types:0x4a32d70 ...>, @content _type="x-drawing/dwf", @raw_media_type="x-drawing", @raw_sub_type="dwf", @simplified="drawing/dwf", @i18n_key="drawing.dwf", @media_type="drawing", @s ub_type="dwf", @extensions=["dwf"]>, #<mime::type::columnar:0x4b01608 @container=#<mime::types:0x4a32d70 ...>, @content_type="x-world/x-vrml", @raw_me dia_type="x-world", @raw_sub_type="x-vrml", @simplified="world/vrml", @i18n_key="world.vrml", @media_type="world", @sub_type="vrml", @extensions=["wrl ", "vrml"]>], @__attributes__=["content_type"], @__root__="c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/mime-types-2.6.1/data">, @content_type ="image/jpeg", @raw_media_type="image", @raw_sub_type="jpeg", @simplified="image/jpeg", @i18n_key="image.jpeg", @media_type="image", @sub_type="jpeg", @extensions=["jpeg", "jpg", "jpe"]>] extension), content type discovered file command: . see documentation allow combination. command :: file -b --mime "c:/users/leomac/appdata/local/temp/08f1277d6726f4c49e8f176e8eaab93020150717-10948-1bnslyr.lua" [paperclip] content type spoof: filename reassembly_wonay_-_f1_t2_v3_wonay_20150602_09.34.45.am__7999p_.lua (application/octet-stream headers, [] extension), content type discovered file command: . see documentation allow combination. (0.0ms) rollback transaction rendered ships/new.html.erb within layouts/application (1.0ms) user load (1.0ms) select "users".* "users" "users"."id" = ? limit 1 [["id", 1]] cache (0.0ms) select "users".* "users" "users"."id" = ? limit 1 [["id", 1]] completed 200 ok in 313758ms (views: 93.0ms | activerecord: 2.0ms)
thank you!
i had similar error, turned out missed installing file command windows not required earlier versions of paperclip. instructions can found here: https://github.com/thoughtbot/paperclip#file
Comments
Post a Comment