Project

General

Profile

Attach-screenshot plugins are broken with RM 1.0

Added by Anonymous over 13 years ago

I was using the redmine_attach_screenshot plugin with 0.9x, but when I upgraded to RM 1.0 it stopped working. I've tried redmine_screenshot_paste too, and it's also broken for the same reason.

The problem is that both of these plugins patch the RM method ApplicationController.attach_files, but that method no longer exists in RM 1.0. It looks as though it got moved to the Attachment class, and made a class method. Unfortunately updating the plugins to patch the new location of the method also fails, because the patch uses the 'params' property, which isn't available in that context.

I've now hit the limit of my medium-weight Ruby fu and lightweight Redmine fu :-( It looks like someone more knowledgeable than I would have to figure out a new strategy for patching Redmine to grab the screenshot from the form params and save it as an attachment.

My immediate problem is that screenshot pasting is considered a high priority feature by my QA team, so this is going to hurt my ongoing quest to replace our nasty Bugzilla installation with Redmine. :-(


Replies (11)

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Anonymous over 13 years ago

I managed to figure out enough about Redmine hooks to rewrite the broken part of the redmine_attach_screenshot plugin!
You can find the fixed version at http://github.com/snej/redmine_attach_screenshot

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Jack Kurzecki over 13 years ago

Thank you Jens - it works perfectly with Redmine 1.0.0.devel.3919

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Max Meier over 13 years ago

I tried to attach a screenshot, but got the following error message:

Processing AttachScreenshotController#index (for 10.10.10.41 at 2010-08-09 09:04:27) [POST]
  Parameters: {"action"=>"index", "controller"=>"attach_screenshot", "key"=>"63fe289d1674b5120162922dcc8b10e92304671f", "attachments"=>#<File:/tmp/RackMultipart20100809-14284-11rw340-0>}

ArgumentError (invalid value for Integer: "090427"):
  vendor/plugins/redmine_attach_screenshot/app/controllers/attach_screenshot_controller.rb:36:in `sprintf'
  vendor/plugins/redmine_attach_screenshot/app/controllers/attach_screenshot_controller.rb:36:in `make_tmpname'
  vendor/plugins/redmine_attach_screenshot/app/controllers/attach_screenshot_controller.rb:13:in `index'

Rendering /var/lib/redmine.devel/public/500.html (500 Internal Server Error)
RAILS_ENV="production" ruby script/about

/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
About your application's environment
Ruby version              1.8.7 (i686-linux)
RubyGems version          1.3.6
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /var/lib/redmine.devel
Environment               production
Database adapter          mysql
Database schema version   20100705164950

About your Redmine plugins
Scrumdashboard plugin              1.2
Redmine Scrum Plugin               2.1 unstable
Redmine Attach Screenshot plugin   0.0.4

Could You figure out, what's wrong?

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Max Meier over 13 years ago

I'm not a ruby programmer, but I found out myself, if I change app/controllers/attach_screenshot_controller.rb:36 from
sprintf('%d_%d%s', User.current.id, date, name) to
sprintf('%d_%s%s', User.current.id, date, name)
it seems to work.

Patch included.

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Bart Stuyckens over 13 years ago

I managed to install the plugin and works great with 1.0.

Except, it always uploads the screenshot using the same filename (screenshot.png). If there is more than one screenshot, it's impossible to visualize the screenshot using "!screenshot.png!" coding. It will always take one of the two (which one ?) and the other cannot be shown.

It would be great if this problem could be fixed.

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Martin G over 13 years ago

I tried this plugin with 1.0.1 and i get following error:

Processing AttachScreenshotController#index (for 127.0.0.1 at 2010-09-02 09:50:07) [POST]
  Parameters: {"action"=>"index", "controller"=>"attach_screenshot", "key"=>"2e5c8db368c134c80e5e686b18132b2713cb0494", "attachments"=>#<File:C:/Windows/Temp/RackMultipart20100902-5996-1ixk0xe-0>}

Magick::ImageMagickError (NoDecodeDelegateForThisImageFormat `C:/Program Files/BitNami Redmine Stack/apps/redmine/tmp/2_095018screenshot.jpg' @ constitute.c/ReadImage/503):
  vendor/plugins/redmine_attach_screenshot/app/controllers/attach_screenshot_controller.rb:18:in `read'
  vendor/plugins/redmine_attach_screenshot/app/controllers/attach_screenshot_controller.rb:18:in `index'

Rendering rescues/layout (internal_server_error)

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Paolo Sulprizio over 13 years ago

I have a problem with RM 1.0.1 too. I can't attach more than one file because the link "Add another file" is 'broken'.Anyone with the same problem?

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Beau Simensen over 13 years ago

Are there any working examples of this plugin working? I'd like to take a look at it in action before I commit to installing it and testing it out.

Thanks!

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by German Belov about 13 years ago

Martin G wrote:

I tried this plugin with 1.0.1 and i get following error:

Processing AttachScreenshotController#index (for 127.0.0.1 at 2010-09-02 09:50:07) [POST]

Parameters: {"action"=>"index", "controller"=>"attach_screenshot", "key"=>"2e5c8db368c134c80e5e686b18132b2713cb0494", "attachments"=>#<File:C:/Windows/Temp/RackMultipart20100902-5996-1ixk0xe-0>}

Magick::ImageMagickError (NoDecodeDelegateForThisImageFormat `C:/Program Files/BitNami Redmine Stack/apps/redmine/tmp/2_095018screenshot.jpg' @ constitute.c/ReadImage/503):

vendor/plugins/redmine_attach_screenshot/app/controllers/attach_screenshot_controller.rb:18:in `read'
vendor/plugins/redmine_attach_screenshot/app/controllers/attach_screenshot_controller.rb:18:in `index'
Rendering rescues/layout (internal_server_error)

I had the same error.
Reboot machine to solve this error.

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Victor Dulepov about 13 years ago

Jens,
we've posted another update of redmine_attach_screenshot to #3816. Works with 1.1.0, does not break the Add another file link.

RE: Attach-screenshot plugins are broken with RM 1.0 - Added by Jonathan Buhacoff almost 12 years ago

Hi, after installing the plugin, it shows up and I'm able to paste the screenshot but when I click the "attach" button I get a message box that says server returned error 500 for /redmine/attach_screenshot.

It looks like the issue is with the content the uploader applet is sending to the server but the source for the uploader applet's .jar file is not in the repository so I'm hoping someone has seen this before and knows what to do.

On the server side, the stack trace looks like this:

Processing SysController#projects to xml (for 127.0.0.1 at 2012-04-11 08:48:02) [GET]
Parameters: {"key"=>"[6Ohu51BZKNTw6IV2n9U2]"}
Filter chain halted as [:check_enabled] rendered_or_redirected.
Completed in 0ms (View: 0, DB: 0) | 403 Forbidden [http://localhost/redmine/sys/projects.xml?key=%5B6Ohu51BZKNTw6IV2n9U2%5D]
/!\ FAILSAFE /!\ Wed Apr 11 08:48:14 -0700 2012
Status: 500 Internal Server Error
bad content body
/usr/share/redmine/vendor/rails/actionpack/lib/action_controller/request.rb:698:in `read_multipart'
/usr/share/redmine/vendor/rails/actionpack/lib/action_controller/request.rb:667:in `loop'
/usr/share/redmine/vendor/rails/actionpack/lib/action_controller/request.rb:667:in `read_multipart'
/usr/share/redmine/vendor/rails/actionpack/lib/action_controller/request.rb:590:in `parse_multipart_form_parameters'

... [lots more snipped]

    (1-11/11)