Browsers automatically given a PDF of issue/issues target page by default.

Added by Will Nue almost 11 years ago

Problem:
---------------
Some PCs/browsers cannot see issues or issue lists, the browsers are automatically given a PDF of the target page by default. Users therefore cannot access the issue pages or issue list pages.

Examples:
---------------
1. User clicks Issues tab in project and download PDF box opens.
- If opened the PDF contains the list of issues.
2. User clicks link to a single issue and download PDF box opens.
- If opened the PDF contains the single issue.
3. User clicks "create" on new issue page after entering issue and download PDF box opens.
- If opened the PDF contains the single issue just created.

Server Details:
---------------
New redmine install running on Instant Rails (Mongrel) under Windows.

Observations:
---------------
Tested on 8 PCs so far as follows:

PC 1 (XP Pro SP2) :
IE7 - Problem occurs

PC 2 (Vista Ultimate) :
IE7 - No problem, links work fine.

PC 3 (XP Pro SP2) :
IE6 - Problem occurs.
FireFox - No problem, links work fine.

PC 4 (XP Pro SP2) :
IE6 - No problem, links work fine.
FireFox - No problem, links work fine.

PC 5 (XP Pro SP2) :
IE7 - Problem occurs

PC 6 (XP Pro SP2) :
IE7 - Problem occurs

PC 7 (XPE SP2) :
IE6 - No problem, links work fine.

PC 8 (XP Pro SP2) :
IE7 - No problem, links work fine.

The problem does not appear to be tied to the user since the problem can occur/not occur with the same user account on different PCs. The problem does not appear to be tied to single browser version since it can occur/not occur on the same browsers version on different PCs.

I find the problem odd since redmine is executing the appropriate build PDF code to export the requested page as a PDF. Is there maybe a condition where the user state is not being detected and redmine defaults to rendering the incoming request as a PDF?

Any help/ideas would be appreciated,
Thanks,
Will

Replies (3)

RE: Browsers automatically given a PDF of issue/issues target page by default. - Added by Thomas Lecavelier almost 11 years ago

Hello Will,

Since that kind of problem never occur before and have very little chance to go unoticed since today, I think about a local network problem:

  • Is there a HTTP proxy between redmine server and the clients? It could be possible that a proxy rather HTTP ignorant (aka: ignoring differencies between GET PUT and POST) present a cache containing a PDF asked previously by an other user.
  • Which version of redmine are you using?

Thanks.

Confirmed the problem, should it get entered as a bug? - Added by Will Nue almost 11 years ago

I believe I have tracked this down to an issue with the IE browsers interacting with redmine's use of the rails respond_to method. This problem will only occur if the calling user's PC has registered pdf as an "Accepted Documents" type in IE.

Location in Windows Registry
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Accepted Documents]
"****"="application/pdf"

We are using redmine-0.7.0_RC1 with no proxies.

Example of redmine respond_to code in issues_controller.rb:
respond_to do |format|
format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? }
format.atom { render_feed(@issues, :title => l(:label_issue_plural)) }
format.csv { send_data(issues_to_csv(@issues, @project).read, :type => 'text/csv; header=present', :filename => 'export.csv') }
format.pdf { send_data(render(:template => 'issues/index.rfpdf', :layout => false), :type => 'application/pdf', :filename => 'export.pdf') }
end

I put the following troubleshooting code in index method of issues_controller.rb.

puts "**** HTTP Request type = " + request.format
puts "**** HTTP Request Method = " + request.request_method.to_s
puts "**** HTTP Accept type = " + request.accepts.to_s

Calling the pages directly through Webrick produced the following results:

Non-working IE7 browser (Note: pdf in MIME type string)
  • HTTP Request type = image/gif
  • HTTP Request Method = get
  • HTTP Accept type = image/gifimage/x-xbitmapimage/jpegimage/pjpegapplication/x-shockwave-flashapplication/vnd.ms-excelapplication/vnd.ms-powerpointapplication/mswordapplication/pdf*/*
Non-working IE7 browser (Note: pdfapplication in MIME type string)
  • HTTP Request type = image/gif
  • HTTP Request Method = get
  • HTTP Accept type = image/gifimage/x-xbitmapimage/jpegimage/pjpegapplication/vnd.ms-excelapplication/vnd.ms-powerpointapplication/mswordapplication/pdfapplication/x-shockwave-flashapplication/x-silverlight*/*
Working IE6 browser (Note: No pdf in MIME type string)
  • HTTP Request type = image/gif
  • HTTP Request Method = get
  • HTTP Accept type = image/gifimage/x-xbitmapimage/jpegimage/pjpegapplication/x-shockwave-flashapplication/vnd.ms-excelapplication/vnd.ms-powerpointapplication/msword*/*

Removing the MIME type from IE through the registry does solve the problem, but it really isn't a deployable solution. My thought would be to check for the "?format=pdf" parameter string that a "real" redmine pdf link appears to have, but I'm not sure how this will interact with responds_to parsing the same parameter. I guess if you do it before the responds_to block it would be OK.

Do you think this should be entered as bug?
Will

RE: Browsers automatically given a PDF of issue/issues target page by default. - Added by William Roush over 7 years ago

Funny, we got nailed with this issue today...

Confirmed that it happens on the Redmine website for systems that have this issue.

(1-3/3)