Skip to content

IMAPMessage violating the IMessage contractΒ #12530

@kesselb

Description

@kesselb

The interface is implemented by OCA\Mail\Model\Message and OCA\Mail\Model\IMAPMessage.

mail/lib/Model/IMessage.php

Lines 119 to 122 in 52214dc

/**
* @return Horde_Mime_Part[]
*/
public function getAttachments(): array;

OCA\Mail\Model\Message is okay:

mail/lib/Model/Message.php

Lines 291 to 305 in 52214dc

/**
* @param string $name
* @param string $content
* @param string $mime
* @return void
*/
private function createAttachmentDetails(string $name, string $content, string $mime): void {
$part = new Horde_Mime_Part();
$part->setCharset('us-ascii');
$part->setDisposition('attachment');
$part->setName($name);
$part->setContents($content);
$part->setType($mime);
$this->attachments[] = $part;
}

OCA\Mail\Model\IMAPMessage is not:

/**
* @return Horde_Mime_Part[]
*/
#[\Override]
public function getAttachments(): array {
return $this->attachments;
}

$this->attachments[] = [
'id' => $p->getMimeId(),
'messageId' => $this->uid,
'fileName' => $p->getName(),
'mime' => $p->getType(),
'size' => $p->getBytes(),
'cid' => $p->getContentId(),
'disposition' => $p->getDisposition()
];

$this->attachments[] = [
'id' => $p->getMimeId(),
'messageId' => $this->uid,
'fileName' => $p->getName(),
'mime' => $p->getType(),
'size' => $p->getBytes(),
'cid' => $p->getContentId(),
'disposition' => $p->getDisposition()
];

Solution

Drop the interface?

It looks like we are always using the actual classes instead of the interface.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions