JodliDev / calendar

GNU Affero General Public License v3.0
16 stars 12 forks source link

Cannot open mail with .ics attachment #31

Open dalgwen opened 1 year ago

dalgwen commented 1 year ago

Hello,

First I want to thank you for keeping this project alive. A FOSS calendar function is a must have and thanks to you it is possible in roundcube. Do you have a ko-fi page or something like that ? I would like to offer you a beverage of your choice.

I followed your guide to install the plugin and it mostly works. Again, thank you. I said "mostly", because I have however an issue when I try to open a mail with an .ics attachment : the mail doesn't open ("oops... something went wrong"), and I can see this in the log :

[21-Sep-2022 00:37:54 Europe/Berlin] PHP Fatal error:  Uncaught Error: Object of class DateTimeImmutable could not be converted to string in /var/www/roundcube/program/lib/Roundcube/rcube_utils.php:1025
Stack trace:
#0 /var/www/roundcube/program/lib/Roundcube/rcube_utils.php(946): rcube_utils::clean_datestr()
#1 /var/www/roundcube/program/include/rcmail.php(1591): rcube_utils::strtotime()
#2 /var/www/roundcube/plugins/calendar/calendar.php(3262): rcmail->format_date()
#3 /var/www/roundcube/program/lib/Roundcube/rcube_plugin_api.php(518): calendar->mail_messagebody_html()
#4 /var/www/roundcube/program/include/rcmail_output_html.php(1615): rcube_plugin_api->exec_hook()
#5 [internal function]: rcmail_output_html->xml_command()
#6 /var/www/roundcube/program/include/rcmail_output_html.php(1322): preg_replace_callback()
#7 /var/www/roundcube/program/include/rcmail_output_html.php(825): rcmail_output_html->parse_xml()
#8 /var/www/roundcube/program/include/rcmail_output_html.php(654): rcmail_output_html->parse()
#9 /var/www/roundcube/program/actions/mail/show.php(161): r in /var/www/roundcube/program/lib/Roundcube/rcube_utils.php on line 1025

I see that it is the "dreaded" DateTimeImmutable you mention on your README. I installed the forked library libcalendaring with the command you provided (I checked it twice, to be sure) in the README. No error during installation. I checked and I have it in the ./plugins/libcalendaring/ directory.

I'm not a php guy and really don't know how to handle this, or what kind of other information I should provide .

Thank you for reading,

dalgwen commented 1 year ago

Hello,

As I said before, I'm not a PHP guy but I managed to get something that looks like a fix for my issue. (I can now open mail with ICS attachment and insert related event into my calendar) I hope you can merge it ?

Thanks

JodliDev commented 1 year ago

Hello Thank you so much for your efforts! Are you sure, that you have installed the right version of libcalendaring? (I guess the best way to check for that is if the name in plugins/libcalendaring/composer.json states "jodlidev/libcalendaring") I am asking because for me emails with ics attachements seem to work. Can you send me an email with an ics attachement that does not work to jodlidev at gmail.com? Maybe it only happens with specific attachements.

I also responded to your PR. Lets hold on that until we figure out if your installation is correct :)

Ps regarding ko-fi Thank you for offering :) But at the moment I am only barely supporting this project and silently still hoping that it will be picked up be the roundcube team at some point.

dalgwen commented 1 year ago

Hello,

Many thanks for your response !

I think that I have the right version ?

root@machine:~# more /var/www/roundcube/plugins/libcalendaring/composer.json
{
    "name": "jodlidev/libcalendaring",
    "type": "roundcube-plugin",
    "description": "Library providing common functions for calendaring plugins",
    "homepage": "https://git.kolab.org/diffusion/RPK/",
....

And also :

root@machine:~# more /var/www/roundcube/plugins/libcalendaring/README
This fork is needed so we can use sabre/vobject >= 4 in the calendar plugin.
If you are a roundcube maintainer reading this, pretty please update libcalendaring so I can delete this fork...

Which seems to be the content of your last commit in your repository.

I sent you an e-mail to reproduce the issue (it does on my environment), but I'm afraid it is a very basic test. If you had this bug, you should already have encountered it. (I just create a event in a a google calendar and add your email as a attendant, which is a 100% reproductible issue with me)

Again, thank you

JodliDev commented 1 year ago

Hm. Yeah. It seems to work on my end :/ So I guess you have a fresh install of roundcube and the calendar?

What php version are you using? And what roundcube verison?

dalgwen commented 1 year ago

It's not a 100% "fresh" install, because it's a little bit customized by the installer (Yunohost)

The differences, AFAIK, are :

So, the version :

List of plugins, from the about page : archive 3.5 automatic_addressbook v0.4.3 calendar dev-master carddav v4.4.1 contextmenu 3.3.1 enigma 0.9 filesystem_attachments 1.0 http_authentication 1.5 jqueryui 1.13.1 libcalendaring dev-master libkolab dev-master managesieve 9.4 markasjunk 2.0 newmail_notifier new_user_dialog new_user_identity xskin 1.8.2 zipdownload 3.4

If it works for you, I guess it could be blamed on something from the Yunohost installation ! The question is "what".... But it doesn't seem to be your calendar's responsibility.

I'm still hoping to have time to work on this issue. (my initial goal was to suggest and maybe help to add your calendar to Yunohost default installation. I think it's a good match, as Yunohost provide some caldav servers and simplicity of installation / connection between components.)

I don't know if you wish/can continue on helping me on this, but anyway, thanks again for your help !