Project

General

Profile

Actions

Defect #21161

closed

Redmine can't access uploaded file with accent

Added by David BOUCHE over 8 years ago. Updated over 1 year ago.

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

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Hello,

I'm having the same issue with two redmine installations, I've made a short vidéo to illustrate the problem : https://youtu.be/u6W9uEPQNHk

I can't consult/download uploaded files with accent. Redmine returns a 404 error.

The log corresponding at the 404 error :

Started GET "//attachments/download/64/Test file with space and accént.jpg" for 2.9.10.148 at 2015-11-05 15:21:34 +0000
Processing by AttachmentsController#download as HTML
  Parameters: {"id"=>"64", "filename"=>"Test file with space and acc\xC3\xA9nt.jpg"}
  Current user: david (id=2)
  Rendered common/error.html.erb within layouts/base (0.2ms)
Filter chain halted as :find_attachment rendered or redirected
Completed 404 Not Found in 94ms (Views: 41.2ms | ActiveRecord: 37.1ms)

Here informations about redmine installations, 1st one (used for the video) :

Environment:
  Redmine version                3.0.3.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  4.2.1
  Environment                    production
  Database adapter               PostgreSQL
SCM:
  Git                            1.9.1
  Filesystem                     
Redmine plugins:
  redmine_agile                  1.3.8

2nd one :

Environment:
  Redmine version                3.1.1.stable
  Ruby version                   2.0.0-p247 (2013-06-27) [x86_64-linux]
  Rails version                  4.2.4
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.6
  Cvs                            1.12.13
  Git                            1.7.0.4
  Filesystem                     
Redmine plugins:
  redmine_agile                  1.3.11
  redmine_contacts               4.0.2
  redmine_contacts_helpdesk      3.0.1

Do not hesite to ask for other details.

Thanks for your support, David

Actions #1

Updated by Toshi MARUYAMA over 8 years ago

  • Status changed from New to Needs feedback

I cannot reproduce.

Started GET "/attachments/download/5/Test%20file%20with%20space%20and%20acc%c3%a9nt.jpg" for 192.168.11.10 at 2015-11-06 13:39:05 +0900
Processing by AttachmentsController#download as HTML
  Parameters: {"id"=>"5", "filename"=>"Test file with space and accént.jpg"}
  Current user: admin (id=1)
Completed 304 Not Modified in 22ms (ActiveRecord: 2.1ms)
Actions #2

Updated by Toshi MARUYAMA over 8 years ago

Your Rubies are very old.

Actions #3

Updated by Toshi MARUYAMA almost 8 years ago

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

No feedback.

Actions #4

Updated by David BOUCHE about 7 years ago

  • Status changed from Closed to Reopened

The issue is still there.

A small video to show you how to reproduce the bug : https://youtu.be/KU4amh1c6so

Administration/information :

Environment:
  Redmine version                3.3.2.stable
  Ruby version                   2.3.3-p222 (2016-11-21) [x86_64-linux]
  Rails version                  4.2.7.1
  Environment                    production
  Database adapter               PostgreSQL
SCM:
  Subversion                     1.8.16
  Git                            2.11.0
  Filesystem                     
Redmine plugins:
  redmine_agile                  1.4.2
  redmine_contacts               4.0.6
  redmine_contacts_helpdesk      3.0.7

If you wan't to reproduce the bug by yourself :

I reproduced the bug on 3 redmine installation with 3 differents environments.

Thanks for your support,
David.

Actions #5

Updated by Toshi MARUYAMA about 7 years ago

  • Status changed from Reopened to Closed
  • Resolution changed from No feedback to Invalid

I think your environment (web server, proxy etc.) problem because filename in your log is URL decoded.

Actions #6

Updated by David BOUCHE almost 7 years ago

  • Status changed from Closed to Reopened

I've found a solution with a local ruby developper.

We've update redmine mannually in app/controllers/attachments_controller.rb:146 :

# before
# raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename
# after
raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename].force_encoding(Encoding::UTF_8) != @attachment.filename.force_encoding(Encoding::UTF_8)

It seems that the encoding of the two information compared wasn't the same.
With this fix, it force the same encoding (and so accent are preserved).

Thanks for your support,
David

Actions #7

Updated by Toshi MARUYAMA almost 7 years ago

  • Status changed from Reopened to Closed

As I said before, it is your environment problem.
Make sure you get same result to run webrick.

Actions #8

Updated by David BOUCHE almost 7 years ago

  • Status changed from Closed to Reopened

I don't know webrick, how can I test with it ?
Actually I'm using nginx.

What should I check/try in my environnent ?

Actions #9

Updated by David BOUCHE almost 7 years ago

May be you can suggest an appropriate configuration.

Actions #10

Updated by Toshi MARUYAMA almost 7 years ago

  • Status changed from Reopened to Closed

David BOUCHE wrote:

May be you can suggest an appropriate configuration.

We don't recommend any Web Server.

Actions #11

Updated by Toshi MARUYAMA almost 7 years ago

David BOUCHE wrote:

I don't know webrick, how can I test with it ?
Actually I'm using nginx.

What should I check/try in my environnent ?

Please use forum for question.

Actions

Also available in: Atom PDF