cypht-org / cypht

Cypht: Lightweight Open Source webmail aggregator [PHP, JS]
http://cypht.org
GNU Lesser General Public License v2.1
949 stars 147 forks source link

viewing a message via jmap fails #950

Closed landryb closed 2 months ago

landryb commented 2 months ago

🐛 Bugreport

still playing with stalwart and cypht master, listing messages work, but viewing one only renders a blank area where there should be a message.

the query to retrieve the message list has this POST:

hm_ajax_hook=ajax_imap_folder_display
imap_server_id=661c434bc6833
folder=494e424f58
hm_page_key=442747cad87c93e009b1d134025ce4351de1c21a83bb8632720272c97129e618

the reply from cypht is:

{"date":"4:54:50",
   "folder_status":{
     "imap_661c434bc6833_494e424f58":{
      "messages":"1","unseen":"0","uidvalidity":"","uidnext":"","recent":""}
},
  "imap_server_id":"661c434bc6833",
  "router_login_state":true,
  "formatted_message_list":{
    "imap_661c434bc6833_a_494e424f58":{
      "0":"<tr class=\"imap_661c434bc6833_a_494e424f58 email seen user2 \"><td class=\"checkbox_cell\"><input id=\"imap_661c434bc6833_a_494e424f58\" type=\"checkbox\" value=\"imap_661c434bc6833_a_494e424f58\" \/><label class=\"checkbox_label\" for=\"imap_661c434bc6833_a_494e424f58\"><\/label><\/td><td class=\"source\" data-title=\"user2\">user2<\/td><td class=\"from\" data-title=\" \">user1@REDACTED<\/td><td class=\"subject\"><div class=\"\"><a title=\"test\" href=\"?page=message&amp;uid=a&amp;list_path=imap_661c434bc6833_494e424f58&amp;list_parent=imap_661c434bc6833_494e424f58&amp;list_page=1\">test<\/a><\/div><\/td><td class=\"msg_date\" title=\"Sun, 14 Apr 2024 11:08:18 +0000\">17 hours, 46 minutes<input type=\"hidden\" class=\"msg_timestamp\" value=\"1713092898\" \/><\/td><td class=\"icon\" title=\"\"><\/td><\/tr>","1":"imap_661c434bc6833_a_494e424f58"}},"page_links":"","router_user_msgs":{}}

and clicking on the first message in the list sends this GET to cypht/?page=message&uid=a&list_path=imap_661c434bc6833_494e424f58&list_parent=imap_661c434bc6833_494e424f58&list_page=1 but the message isnt shown in the right area.

maybe the message uid is wrong ?

Shadow243 commented 2 months ago

This issue is coming from here:

if (array_key_exists('uid', $this->request->get) && preg_match("/\d+/", $this->request->get['uid'])) {
            $uid = $this->request->get['uid'];
        }

with Stalwart ui are not digits i'll remove preg_match to make it work.

landryb commented 2 months ago

can confirm that #960 fixes JMAP message display coming from stalwart, thanks !