Translations: English
Search on Docs:
   
ActionItem Search:

#1881: Duplicate uploaded file for published articles

Type: BugItem Feature: ContentManagement Tags: colivre
ScheduledFor: N/A Assigned to:   Sites:  
Priority: 5 Status: Pending  

Description of the bug

Subject: [Noosfero ERROR] content_viewer#view_page (TypeError) "can't convert nil into String"
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8

A TypeError occurred in content_viewer#view_page:

  can't convert nil into String
  [RAILS_ROOT]/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:21:in `join'

-------------------------------
Request:
-------------------------------

  * URL       : http://softwarelivre.org/apyb/seminario-t.-da-comunicacao.ppt?lang=ru&view=true
  * Parameters: {"profile"=>"apyb", "action"=>"view_page", "page"=>["seminario-t.-da-comunicacao.ppt"], "lang"=>"ru", "view"=>"true", "controller"=>"content_viewer"}
  * Rails root: /var/lib/noosfero/current

-------------------------------
Backtrace:
-------------------------------

  [RAILS_ROOT]/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:21:in `join'
  [RAILS_ROOT]/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:21:in `full_filename'
  [RAILS_ROOT]/app/models/uploaded_file.rb:76:in `data'
  [RAILS_ROOT]/app/controllers/public/content_viewer_controller.rb:61:in `view_page'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `send'

Testing environment

-- JoenioCosta -- 18 Feb 2011

The problem is on the filename field on many UploadedFiles registers inside the database. If that filed is null the bug happens.

I opened some CMS pages to search by the files and that fails too. This problem may be brokeing some other views.

The problem comes (very probably) on the creation and that is probably from attachment_fu plugin.

A way to find broken UploadedFiles is that:
bfs = Article.find_by_sql("select * from articles where type='UploadedFile' and filename is null")

-- AurelioAHeckert - 24 Feb 2011

A good solution is to duplicate the uploaded file, because the original one can be changed after is was published. The duplication should be done with Attachment Fu ArticleModel.new(:uploaded_data => ActionController::TestUploadedFile.new(path, mimetype)), because this way the meta data is correctly stored and the file is correctly uploaded to its location. There must be also a migration to do this with the old stuff.

-- CaioSBA - 18 Mar 2011
Add comment
You need to login to be able to comment.
 

ActionItemForm edit

Title Duplicate uploaded file for published articles
ActionItemType BugItem
Priority Medium
Tags colivre
Feature ContentManagement
Plugin
ResponsibleDevelopers
ScheduledFor N/A
AffectsVersion
Status Pending
Ticket SAC:
Topic attachments
I Attachment Action Size Date Who Comment
mail1.txttxt mail1.txt manage 9 K 18 Feb 2011 - 02:41 JoenioCosta  
mail2.txttxt mail2.txt manage 9 K 18 Feb 2011 - 02:41 JoenioCosta  
mail3.txttxt mail3.txt manage 9 K 18 Feb 2011 - 02:42 JoenioCosta  
mail4.txttxt mail4.txt manage 9 K 18 Feb 2011 - 02:42 JoenioCosta  
mail5.txttxt mail5.txt manage 9 K 18 Feb 2011 - 02:42 JoenioCosta  
Topic revision: r1 - 22 May 2015, UnknownUser

irc Talk with Devs Now!

Copyright © 2007-2019 by the Noosfero contributors
Colivre - Cooperativa de Tecnologias Livres