Project

General

Profile

Actions

Defect #16422

closed

In attachment.rb thumbnail function could not return target correct

Added by chih-jen chuang about 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Attachments
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
No feedback
Affected version:

Description

In the lines from 200 to 207

   begin
      Redmine::Thumbnail.generate(self.diskfile, target, size) # <== could not return target success, even if target is correct.
   rescue => e
      logger.error "An error...." 
      return nil
   end

add return target

   begin
      Redmine::Thumbnail.generate(self.diskfile, target, size)
      return target # <== it's correct on my site
   rescue => e
      logger.error "An error...." 
      return nil
   end
Actions #1

Updated by Jean-Philippe Lang almost 10 years ago

  • Status changed from New to Needs feedback

Could you describe under which conditions it fails to return the target?

Actions #2

Updated by chih-jen chuang almost 10 years ago

My environment
OS: ubuntu 12.04
ruby: rvm install ruby 1.9.3p484 rails 3.2.7
database: postgresql 9.1.12
redmine: 2.5.0.stable
ImageMagick: 6.6.9-7

Conditions:
I have a issue with image attachment, but can't see thumbnail of that image.
I trace the code and found the problem in my computer.

Actions #3

Updated by Toshi MARUYAMA almost 10 years ago

  • Category changed from Issues to Attachments
Actions #4

Updated by Toshi MARUYAMA almost 10 years ago

It's strange.

http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Method_Calls#Return_Values

Methods return the value of the last statement executed.

$ irb
1.9.3-p545 :001 > def test
1.9.3-p545 :002?>   begin
1.9.3-p545 :003 >       1
1.9.3-p545 :004?>     rescue => e
1.9.3-p545 :005?>     return nil
1.9.3-p545 :006?>     end
1.9.3-p545 :007?>   end
 => nil
1.9.3-p545 :008 > test
 => 1

Actions #5

Updated by Toshi MARUYAMA almost 10 years ago

It seems you modify Redmine::Thumbnail#generate
source:tags/2.5.1/lib/redmine/thumbnail.rb#L41

Actions #6

Updated by Jean-Philippe Lang almost 9 years ago

  • Status changed from Needs feedback to Closed
  • Resolution set to No feedback
Actions

Also available in: Atom PDF