Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117819167
D5084.1775290223.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D5084.1775290223.diff
View Options
diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -513,6 +513,7 @@
$attachments = array_merge($message->attachments, $message->inline_parts);
if (!empty($attachments)) {
$result['attachments'] = [];
+ $attachment_ids = [];
foreach ($attachments as $attachment) {
$att = [];
@@ -521,6 +522,10 @@
continue;
}
+ if (in_array($attachment->mime_id, $attachment_ids)) {
+ continue;
+ }
+
$filename = rcube_charset::clean($attachment->filename);
if (empty($filename) && $attachment->mimetype == 'text/html') {
$filename = 'HTML Part';
@@ -528,21 +533,23 @@
$att['displayName'] = $filename;
$att['fileReference'] = $serverId . '::' . $attachment->mime_id;
- $att['method'] = 1;
+ $att['method'] = strcasecmp($attachment->mimetype, 'message/rfc822') === 0 ? 5 : 1;
$att['estimatedDataSize'] = $attachment->size;
if (!empty($attachment->content_id)) {
$att['contentId'] = rcube_charset::clean($attachment->content_id);
}
+
if (!empty($attachment->content_location)) {
$att['contentLocation'] = rcube_charset::clean($attachment->content_location);
}
- if (in_array($attachment, $message->inline_parts)) {
+ if (strcasecmp($attachment->disposition, 'inline') === 0) {
$att['isInline'] = 1;
}
$result['attachments'][] = new Syncroton_Model_EmailAttachment($att);
+ $attachment_ids[] = $attachment->mime_id;
}
}
diff --git a/tests/Sync/Sync/EmailTest.php b/tests/Sync/Sync/EmailTest.php
--- a/tests/Sync/Sync/EmailTest.php
+++ b/tests/Sync/Sync/EmailTest.php
@@ -155,6 +155,12 @@
$this->assertStringMatchesFormat("{$folderId}::%d", $xpath->query("{$root}/ns:ServerId")->item(0)->nodeValue);
$this->assertSame('sync test with attachment', $xpath->query("{$root}/ns:ApplicationData/Email:Subject")->item(0)->nodeValue);
$this->assertSame(1, $xpath->query("{$root}/ns:ApplicationData/AirSyncBase:Body")->count());
+ $attachments = $xpath->query("{$root}/ns:ApplicationData/AirSyncBase:Attachments/AirSyncBase:Attachment");
+ $this->assertSame(1, $attachments->count());
+ $this->assertSame('logo.gif', $xpath->query('AirSyncBase:DisplayName', $attachments->item(0))->item(0)->nodeValue);
+ $this->assertSame('1', $xpath->query('AirSyncBase:Method', $attachments->item(0))->item(0)->nodeValue);
+ $this->assertSame('76', $xpath->query('AirSyncBase:EstimatedDataSize', $attachments->item(0))->item(0)->nodeValue);
+ $this->assertSame('1', $xpath->query('AirSyncBase:IsInline', $attachments->item(0))->item(0)->nodeValue);
return $syncKey;
}
diff --git a/tests/SyncTestCase.php b/tests/SyncTestCase.php
--- a/tests/SyncTestCase.php
+++ b/tests/SyncTestCase.php
@@ -294,7 +294,7 @@
// Make sure user is authenticated
$this->getImapStorage();
- if (!empty($sync->user)) {
+ if ($sync->user) {
// required e.g. for DAV client cache use
\rcube::get_instance()->user = $sync->user;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 8:10 AM (11 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18828612
Default Alt Text
D5084.1775290223.diff (3 KB)
Attached To
Mode
D5084: Fix mail attachment duplicates, improve attachment Method and IsInline values
Attached
Detach File
Event Timeline