Skip to content

Commit 7fb49ff

Browse files
lubo92kesselb
authored andcommitted
fixup! fix(imap): detect iMIP when method= is missing or mime is application/ics
Add a regression test exercising ImapMessageFetcher::getPart()'s METHOD-from-body fallback (which is the new branch introduced by this PR). Uses the existing request_proton_bridge fixture and the same saveMimeMessage / fetchMessage pattern as the surrounding S/MIME tests, so it goes through the real Horde+IMAP stack instead of just parsing the MIME tree like the MessageMapperTest case does. Asserts that the scheduling entry is emitted, its method is REQUEST, and the contents we stash contain the METHOD: line we parsed. AI-assisted: Claude Code (Claude Opus 4.7) Signed-off-by: Wolfgang Lubowski <w.lub92@gmail.com>
1 parent 9dac7ac commit 7fb49ff

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

tests/Integration/IMAP/ImapMessageFetcherIntegrationTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,29 @@ public function testFetchMessageWithOpaqueSignedMessage(): void {
230230
$this->assertTrue($message->isSigned());
231231
$this->assertTrue($message->isSignatureValid());
232232
}
233+
234+
/**
235+
* Proton Mail Bridge strips the `method=` parameter from the
236+
* text/calendar Content-Type during E2E re-assembly. The fetcher must
237+
* fall back to parsing the METHOD: line out of the ICS body, and
238+
* still emit a scheduling entry so downstream rendering picks it up.
239+
*/
240+
public function testFetchMessageWithImipRequestMissingMethodParam(): void {
241+
$rawMessage = file_get_contents(__DIR__ . '/../../data/imip/request_proton_bridge.txt');
242+
$uid = $this->saveMimeMessage('INBOX', $rawMessage);
243+
$fetcher = $this->fetcherFactory
244+
->build(
245+
$uid,
246+
'INBOX',
247+
$this->getTestClient(),
248+
$this->account->getUserId()
249+
)
250+
->withBody(true);
251+
252+
$message = $fetcher->fetchMessage();
253+
254+
$this->assertCount(1, $message->scheduling);
255+
$this->assertSame('REQUEST', $message->scheduling[0]['method']);
256+
$this->assertStringContainsString('METHOD:REQUEST', $message->scheduling[0]['contents']);
257+
}
233258
}

0 commit comments

Comments
 (0)