Commit eb2c81cd authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #87 in ZP/z-push from...

Merge pull request #87 in ZP/z-push from bugfix/ZP-584-downloading-email-attachments-within to develop

* commit '558d4f26':
  ZP-584 downloading email attachments within public folders fails on some android devices.
  ZP-584 downloading email attachments within public folders fails on some android devices.

(cherry picked from commit a97725a4)
parent c37ea5bd
...@@ -205,6 +205,7 @@ class MAPIMapping { ...@@ -205,6 +205,7 @@ class MAPIMapping {
"representingentryid" => PR_SENT_REPRESENTING_ENTRYID, "representingentryid" => PR_SENT_REPRESENTING_ENTRYID,
"sourcekey" => PR_SOURCE_KEY, "sourcekey" => PR_SOURCE_KEY,
"entryid" => PR_ENTRYID, "entryid" => PR_ENTRYID,
"parentsourcekey" => PR_PARENT_SOURCE_KEY,
"body" => PR_BODY, "body" => PR_BODY,
"rtfcompressed" => PR_RTF_COMPRESSED, "rtfcompressed" => PR_RTF_COMPRESSED,
"html" => PR_HTML, "html" => PR_HTML,
...@@ -524,4 +525,4 @@ class MAPIMapping { ...@@ -524,4 +525,4 @@ class MAPIMapping {
); );
} }
} }
?> ?>
\ No newline at end of file
...@@ -677,6 +677,7 @@ class MAPIProvider { ...@@ -677,6 +677,7 @@ class MAPIProvider {
$attachtable = mapi_message_getattachmenttable($mapimessage); $attachtable = mapi_message_getattachmenttable($mapimessage);
$rows = mapi_table_queryallrows($attachtable, array(PR_ATTACH_NUM)); $rows = mapi_table_queryallrows($attachtable, array(PR_ATTACH_NUM));
$entryid = bin2hex($messageprops[$emailproperties["entryid"]]); $entryid = bin2hex($messageprops[$emailproperties["entryid"]]);
$parentSourcekey = bin2hex($messageprops[$emailproperties["parentsourcekey"]]);
foreach($rows as $row) { foreach($rows as $row) {
if(isset($row[PR_ATTACH_NUM])) { if(isset($row[PR_ATTACH_NUM])) {
...@@ -708,7 +709,7 @@ class MAPIProvider { ...@@ -708,7 +709,7 @@ class MAPIProvider {
// set AS version specific parameters // set AS version specific parameters
if (Request::GetProtocolVersion() >= 12.0) { if (Request::GetProtocolVersion() >= 12.0) {
$attach->filereference = $entryid.":".$row[PR_ATTACH_NUM]; $attach->filereference = sprintf("%s:%s:%s", $entryid, $row[PR_ATTACH_NUM], $parentSourcekey);
$attach->method = (isset($attachprops[PR_ATTACH_METHOD])) ? $attachprops[PR_ATTACH_METHOD] : ATTACH_BY_VALUE; $attach->method = (isset($attachprops[PR_ATTACH_METHOD])) ? $attachprops[PR_ATTACH_METHOD] : ATTACH_BY_VALUE;
// if displayname does not have the eml extension for embedde messages, android and WP devices won't open it // if displayname does not have the eml extension for embedde messages, android and WP devices won't open it
...@@ -741,7 +742,7 @@ class MAPIProvider { ...@@ -741,7 +742,7 @@ class MAPIProvider {
} }
else { else {
$attach->attsize = $attachprops[PR_ATTACH_SIZE]; $attach->attsize = $attachprops[PR_ATTACH_SIZE];
$attach->attname = $entryid.":".$row[PR_ATTACH_NUM]; $attach->attname = sprintf("%s:%s:%s", $entryid, $row[PR_ATTACH_NUM], $parentSourcekey);
if(!isset($message->attachments)) if(!isset($message->attachments))
$message->attachments = array(); $message->attachments = array();
......
...@@ -661,7 +661,10 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -661,7 +661,10 @@ class BackendZarafa implements IBackend, ISearchProvider {
if(!strpos($attname, ":")) if(!strpos($attname, ":"))
throw new StatusException(sprintf("ZarafaBackend->GetAttachmentData('%s'): Error, attachment requested for non-existing item", $attname), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT); throw new StatusException(sprintf("ZarafaBackend->GetAttachmentData('%s'): Error, attachment requested for non-existing item", $attname), SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
list($id, $attachnum) = explode(":", $attname); list($id, $attachnum, $parentEntryid) = explode(":", $attname);
if (isset($parentEntryid)) {
$this->Setup(ZPush::GetAdditionalSyncFolderStore($parentEntryid));
}
$entryid = hex2bin($id); $entryid = hex2bin($id);
$message = mapi_msgstore_openentry($this->store, $entryid); $message = mapi_msgstore_openentry($this->store, $entryid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment