From f92052fd73057faddc708f094108b0f19fea7f37 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 5 Sep 2016 10:18:00 +0200 Subject: [PATCH] Fix so when moving to Trash we make sure the folder exists (#5192) --- CHANGELOG | 1 + program/lib/Roundcube/rcube_imap.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d4af572d9..45f26c24c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -53,6 +53,7 @@ CHANGELOG Roundcube Webmail - Fix error causing empty INBOX listing in Firefox when using an URL with user:password specified (#5400) - Fix PHP warning when handling shared namespace with empty prefix (#5420) - Fix so folders list is scrolled to the selected folder on page load (#5424) +- Fix so when moving to Trash we make sure the folder exists (#5192) RELEASE 1.2.1 ------------- diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index c98462494..3ab1a1506 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -2596,6 +2596,14 @@ class rcube_imap extends rcube_storage // move messages $moved = $this->conn->move($uids, $from_mbox, $to_mbox); + // when moving to Trash we make sure the folder exists + // as it's uncommon scenario we do this when MOVE fails, not before + if (!$moved && $to_trash && $this->get_response_code() == rcube_storage::TRYCREATE) { + if ($this->create_folder($to_mbox, true, 'trash')) { + $moved = $this->conn->move($uids, $from_mbox, $to_mbox); + } + } + if ($moved) { $this->clear_messagecount($from_mbox); $this->clear_messagecount($to_mbox);