Author Topic: open attachment in preview window  (Read 11946 times)

Offline CaptainBalou

  • Newbie
  • *
  • Posts: 7
open attachment in preview window
« on: December 11, 2015, 05:36:24 PM »
Hello,

I just upgraded from 0.9.4 to 1.1.3. I upgraded through bin/installto.sh. Everything went smooth. The only thing I saw was a hint at the end of the script which told me that there is a problem with the mime magic stuff. I cannot remember the wording exactly. The script told me that it is possible to rerun it to check that again so I didn't noticed. But running the script again results in "destination directory already up to date". I don't know if this is linked to my problem I want to explain now. Let's see...

When I opened an email with attachment in 0.9.4 and clicked on the attachment a new window opened with the attachment loaded inside of it. This is what I am used to and this is what I like.
Since upgrading to 1.1.3 this behaviour changed a bit. I can click on the attachment and I am getting asked if I want to save or cancel. I can click on an arrow to the right of the file name but the "Open" link is something like deactivated. Clicking on Open results in...nothing.

So the two questions I have are:

1. What do I have to do to activate the "Open" again?
2. Where can I make "Open" the default again?


Regards
Marco

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: open attachment in preview window
« Reply #1 on: December 11, 2015, 06:54:46 PM »
Try setting mime_types in your Roundcube config.

Offline CaptainBalou

  • Newbie
  • *
  • Posts: 7
Re: open attachment in preview window
« Reply #2 on: December 12, 2015, 05:58:22 PM »
Hello,

thanks for giving this hint. The file is in /etc in my Ubuntu 12.04.5 LTS. I took the parameter out of the defaults file and put it into the config file.

$config['mime_types'] = '/etc/mime.types';

Unfortunately nothing changed.

Regards
Marco

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: open attachment in preview window
« Reply #3 on: December 12, 2015, 07:07:43 PM »
PHP may not be able to read the file in that location, try copying it to the Roundcube directory making sure the permissions are correct and set the path to that file.

Offline CaptainBalou

  • Newbie
  • *
  • Posts: 7
Re: open attachment in preview window
« Reply #4 on: December 12, 2015, 07:25:07 PM »
No, that didn't changed it. I copied it into the roundcube directory and it's world readable.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: open attachment in preview window
« Reply #5 on: December 12, 2015, 07:43:57 PM »
Hmm maybe try setting client_mimetypes then.

Offline CaptainBalou

  • Newbie
  • *
  • Posts: 7
Re: open attachment in preview window
« Reply #6 on: December 14, 2015, 02:23:01 PM »
Hello,

I tried a lot with mime parameters you mentioned in the config file but nothing helped me out of this. I reverted back to my original configuration. But today I was wondering because suddenly it worked - but on my Windows workstation at work. So now I have to clarify this. I have the following workstations:

MacBook Pro, Mac OS El Capitan, 10.11.1, Firefox 42.0                              :  "open" is gray and not usable
Thinkpad, Windows 8.1, Firefox ESR (exact release unknown right now)  : "open" is _not_ gray and works as expected

In my previous version 0.9.4 I also used the preview window in Mac OS so I could not imagine why this shouldn't work in 1.1.3 anymore. Any ideas? :)

Regards
Marco

Offline alec

  • Hero Member
  • *****
  • Posts: 1,363
Re: open attachment in preview window
« Reply #7 on: December 14, 2015, 03:06:18 PM »
What kind of attachments are you talking about, PDF? Maybe your Firefox have no plugin for PDF or it's is not detected by Roundcube.

Offline CaptainBalou

  • Newbie
  • *
  • Posts: 7
Re: open attachment in preview window
« Reply #8 on: December 15, 2015, 05:54:19 PM »
Hello,

I'm basicly testing with PDFs because Firefox is able to display them without having plugins or so. But first, let me tell you guys my newest test results.

I was trying with those two machines I was talking about in my last post:

MacBook Pro, Mac OS El Capitan, 10.11.1, Firefox 42.0                              :  "open" is gray and not usable
Thinkpad, Windows 8.1, Firefox ESR (exact release unknown right now)  : "open" is _not_ gray and works as expected

So I did the following:
- I logged in to my Windows 8.1 workstation, started Firefox, logged into Roundcube
- I opened a mail with a PDF attachment
- I clicked on "Open". The new window opened as expected
- Then I copied the url of this new window. I just wanted to look what happens on my MacBook after clicking it.

- So I sent it to my MacBook, logged on into Roundcube and clicked it in a new window
  (e.g. https://www.domain.tld/webmail/?_task=mail&_action=get&_mbox=INBOX&_uid=17883&_part=2&_frame=1&_extwin=1)
- And, tadaaaa, the content was perfect as on the other machine.

So basicly I wanted to see if the "Open" is gray because something is missing and the new windows with the attachment would never be able to display correctly OR if the "Open" is gray for whatever reason even the link works and all is getting displayed as expected. I don't know if anybody here is able to tell me more about that issue now but this is what I tested. Can someone tell me on which action the source code decides to display that "Open" or not? To be honest I am not a good developer and I cannot understand all that code of roundcube... :(

BTW I found another Windows 8.1 machine with Firefox (some release) which also has a gray "Open". So it's not depending on the OS or the Firefox Release.


Regards
Marco
« Last Edit: December 15, 2015, 05:57:52 PM by CaptainBalou »

Offline alec

  • Hero Member
  • *****
  • Posts: 1,363
Re: open attachment in preview window
« Reply #9 on: December 16, 2015, 02:10:53 AM »
As I've said, this is most likely pdf plugin detection. https://github.com/roundcube/roundcubemail/blob/master/program/js/app.js#L8791

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: open attachment in preview window
« Reply #10 on: December 16, 2015, 03:25:58 AM »
Interestingly that test also fails for me in firefox 43.0 on OS X even though I can open pdf's in browser just fine. When I query:
Code: [Select]
navigator.mimeTypes["application/pdf"] it returns:
Code: [Select]
MimeType { description: "", enabledPlugin: null, suffixes: "", type: "application/pdf" } Because enabledPlugin is null the check fails. Looks like a bug to me.

Edit:
So I've done some looking around and it doesn't seem like there is a good solution: http://stackoverflow.com/questions/15240506/detect-whether-the-native-pdf-viewer-in-firefox-introduced-in-firefox-19-is-th All the work arounds seem like overkill for the problem.
« Last Edit: December 16, 2015, 03:42:32 AM by SKaero »

Offline CaptainBalou

  • Newbie
  • *
  • Posts: 7
Re: open attachment in preview window
« Reply #11 on: December 16, 2015, 04:04:50 AM »
Ok, with seeing these snipplets of the source code I understand a bit what happens. I understand that I don't see that "Open" because I have no plugin for PDF. But wouldn't it be easy to say:

if Firefox Version >=19; then
  enable Open button
else
  do what source code does today
fi

Or something like that?

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: open attachment in preview window
« Reply #12 on: December 16, 2015, 10:39:51 AM »
Thats not a good solution because there are a lot of browsers that use the FireFox core but not the Firefox name they wouldn't be picked up by such a check. Its also possible to be using FireFox and to have disabled the build in PDF reader in which case it shouldn't open the view page but there isn't any way to check if that change has been made.

That said feel free to make the change in your own installation, I just doubt it would be accepted into the mainline release.

Offline CaptainBalou

  • Newbie
  • *
  • Posts: 7
Re: open attachment in preview window
« Reply #13 on: December 16, 2015, 10:44:39 AM »
I understand. Things sometimes look easier as they are after such explanations. ;)

If I think I have THE solution for this, do you know the correct way of putting this into a process of review and discussion? Is it this forum or is it the ticket system?

Offline alec

  • Hero Member
  • *****
  • Posts: 1,363
Re: open attachment in preview window
« Reply #14 on: December 16, 2015, 11:56:32 AM »
The ticket system.

It looks like the only way is to use an <object> with empty/dummy pdf file, similiar to the method we use for tiff support check.