downloads failing in ruby 1.8.7

Support Ticket

+status
answered
+tags
 

 

I am including a pdf file card for download.

1. I add card and specified the file type and I select the file to upload to the server.

2. THe file is uploaded and I can see it on ther server.

3. However when I select the card it tries to upload it but I get a wagn Hitch. 

4.  I am ruby 1.8.7

5. I copied the exception stack below.

6. CODE I added ... Exception is in render_show_file

7.  the error was in render_show_file in the application_controller. I put some print statements.

The params were empty. It is indeed null

 

  def render_show_file
    return fast_404 if !@card
    @card.selected_rev_id = (@rev_id || @card.current_revision_id).to_i
 
    format = @card.attachment_format(params[:format])
    return fast_404 if !format

    if ![format, 'file'].member?( params[:format] )
      return redirect_to( request.fullpath.sub( /\.#{params[:format]}\b/, '.' + format ) ) #@card.attach.url(style) )
    end

    style = @card.attachment_style( @card.typecode, params[:size] || @style )
    return fast_404 if !style
    fileHandle = File.open("/tmp/mikesLog", "w")
    fileHandle.puts "HELLO GOT TO HERE"
    fileHandle.puts style
    fileHandle.puts @card.inspect
    fileHandle.close
    send_file @card.attach.path(style),
      :type => @card.attach_content_type,
      :filename =>  "#{@card.cardname.to_url_key}#{style.blank? ? '' : '-'}#{style}.#{format}",
      :x_sendfile => true,
      :disposition => (params[:format]=='file' ? 'attachment' : 'inline' )
  end

 

 

Started GET "/files/Home+ContactDownload-6085.pdf" for 10.5.4.20 at Wed Oct 10 11:03:47 -0700 2012
Processing by CardController#show_file as PDF
  Parameters: {"id"=>"Home+ContactDownload-6085"}
exception = ArgumentError: interning empty string


Controller exception: interning empty string
Completed 500 Internal Server Error in 279ms

ArgumentError (interning empty string):
  app/controllers/application_controller.rb:146:in `render_show_file'
  app/controllers/application_controller.rb:122:in `render_show'
  app/controllers/application_controller.rb:106:in `render_errors'
  app/controllers/application_controller.rb:176:in `__bind_1349892228_291061'

rocessing by ApplicationController#bad_address as PNG
Parameters: {"id"=>"attaches/icon/missing"}
exception = Wagn::BadAddress: could not find a route to match this address
attachment_format issue: can't convert nil into String
Rendered text template (0.0ms)
Completed 404 Not Found in 8ms (Views: 1.4ms | ActiveRecord: 0.0ms)


Started GET "/files/Home+ContactDownload-6085.pdf" for 10.5.4.20 at Wed Oct 10 16:01:20 -0700 2012
Processing by CardController#show_file as PDF
Parameters: {"id"=>"Home+ContactDownload-6085"}
exception = ArgumentError: interning empty string
 

I think this code got pushed to master too soon.  If you pull the latest, you should be in good shape.


There were some ruby 1.8.7 bugs in Wagn 1.9.0. They've been fixed in 1.9.1

  --Ethan McCutchen.....2012-11-08 17:42:39 +0000