Skip to content

Commit

Permalink
[mms] Fix encoding/decoding URL elements in IMAP/POP3 URLs.
Browse files Browse the repository at this point in the history
Need rawurl[en|de]code(), since we need to follow strict RFC semantics
  • Loading branch information
slusarz committed Aug 19, 2014
1 parent f184789 commit a371cf8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions framework/Imap_Client/lib/Horde/Imap/Client/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class Horde_Imap_Client_Url implements Serializable
public $hostspec = null;

/**
* The IMAP mailbox
* The IMAP mailbox.
*
* @todo Make this a Horde_Imap_Client_Mailbox object.
*
* @var string
*/
Expand Down Expand Up @@ -171,14 +173,14 @@ public function __toString()
$url .= '/';

if (is_null($this->protocol) || ($this->protocol == 'imap')) {
$url .= urlencode($this->mailbox);
$url .= rawurlencode($this->mailbox);

if (!empty($this->uidvalidity)) {
$url .= ';UIDVALIDITY=' . $this->uidvalidity;
}

if (!is_null($this->search)) {
$url .= '?' . urlencode($this->search);
$url .= '?' . rawurlencode($this->search);
} else {
if (!is_null($this->uid)) {
$url .= '/;UID=' . $this->uid;
Expand Down Expand Up @@ -260,7 +262,7 @@ protected function _parse($url)
$this->uidvalidity = intval(substr($mbox, $pos + 13));
$mbox = substr($mbox, 0, $pos);
}
$this->mailbox = urldecode($mbox);
$this->mailbox = rawurldecode($mbox);
} else {
$parts = array();
}
Expand All @@ -272,7 +274,7 @@ protected function _parse($url)
$this->$property = $v;
}
} elseif (isset($data['query'])) {
$this->search = urldecode($data['query']);
$this->search = rawurldecode($data['query']);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions framework/Imap_Client/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Fix encoding/decoding URL elements in IMAP/POP3 URLs.
* [mms] Fix setting default port for POP3 URLs.
* [mms] Fix client-side reverse sorting.
* [mms] Fix client-side sequence sorting, when that is the only sort criteria.
Expand Down Expand Up @@ -2657,6 +2658,7 @@
<date>2014-08-19</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Fix encoding/decoding URL elements in IMAP/POP3 URLs.
* [mms] Fix setting default port for POP3 URLs.
* [mms] Fix client-side reverse sorting.
* [mms] Fix client-side sequence sorting, when that is the only sort criteria.
Expand Down

0 comments on commit a371cf8

Please sign in to comment.