Author Topic: Elastic Theme - Issue with contact images  (Read 959 times)

Offline catasolo

  • Newbie
  • *
  • Posts: 2
Elastic Theme - Issue with contact images
« on: December 12, 2020, 02:47:36 PM »
For years I used Larry theme without any issues but there is a new theme called Elastic in version 1.4.9 I upgraded to recently. I like it and I would like to keep using it but ...

I opened the Console in my browser and I started to play with the new interface. I found an issue which is related to Elastic theme only (I checked it with Larry theme and there is no message in Console). When I click on messages in Inbox/Drafts/Sent/Trash/spam to check their contents in Console I get the following error:

Code: [Select]
GET http://mydomain.tld/roundcube/?_task=addressbook&_action=photo&_email=contact%40mydomain.tld&_error=1 404 (Photo not found)
This is happening because _error value is set to 1 in URL. I did not find from where it comes but I can quickly fix by commenting line 92 in file /roundcube/program/steps/addressbook/photo.inc

Code: [Select]
if ($data) {
    header('Content-Type: ' . rcube_mime::image_content_type($data));
    echo $data;
}
else if (!empty($_GET['_error'])) {
    // header('HTTP/1.0 404 Photo not found'); <-- commented here
}
else {
    header('Content-Type: image/gif');
    echo base64_decode(rcmail_output::BLANK_GIF);
}

I created a contact, I uploaded a photo for it, and the message is gone from Console. In my opinion this is happening because the developer did not evaluate that we don't use images for contacts.

Does anyone know how to fix this theme? I guess it is a matter of an if statement ...

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,628
Re: Elastic Theme - Issue with contact images
« Reply #1 on: December 13, 2020, 03:59:59 AM »
This is not a bug or an oversight by the developers. The 404 status is returned because browser error handling is used to show the placeholder image in the case when no contact image exists. I think it is true that it does not specifically have to be a 404 status code to trigger that. According to this HTML spec browsers should check the response content and not only the HTTP status code.

What exactly about this is preventing you from using the Elastic theme?

I've opened a ticket about it https://github.com/roundcube/roundcubemail/issues/7777
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline catasolo

  • Newbie
  • *
  • Posts: 2
Re: Elastic Theme - Issue with contact images
« Reply #2 on: December 14, 2020, 06:27:27 AM »
I agree 404 error should be generated only when there is an image associated for a contact but it cannot be loaded in browser.

I changed into the code from 404 to 204. No content is a proper response code in this case.

Thank you for your help.