Zipdownload: fix escaping in Mbox downloads#10151
Conversation
7e9bc04 to
9ecb474
Compare
0cad7a6 to
9bf4cc5
Compare
| 'INBOX.mbox' => ['From test-from', "\nFrom thomas", "\n>From line which needs to be escaped"], | ||
| ]); | ||
| } finally { | ||
| $browser->removeDownloadedFile($filename); |
There was a problem hiding this comment.
I would prefer doing assertions after removing the file. The test files are small so we can keep them in memory.
There was a problem hiding this comment.
Do you mean something like:
- extract filenames / file contents,
- remove zip file (no try/finally block required),
- do all assertions
probably all in checkFilesInZip()?
Also, just for future reference, would you prefer that I add new commits to this branch, or force-push existing commit(s) to keep the history a bit cleaner?
There was a problem hiding this comment.
1. extract filenames / file contents, 2. remove zip file (no try/finally block required), 3. do all assertionsprobably all in
checkFilesInZip()?
Yes, not necessarily in a single method.
Also, just for future reference, would you prefer that I add new commits to this branch, or force-push existing commit(s) to keep the history a bit cleaner?
Doesn't matter, I usually use the "Squash and merge" button.
There was a problem hiding this comment.
I've simplified the E2E tests w/o changing what is tested, should be better now.
This checks an Mbox download has a properly escaped From line, and also checks at least some content of each zipped file (which as a side effect verifies the zips' CRCs).
Closes #10150.
This unfortunately adds some extra complication... a simpler alternative might be slurp each entire email into a variable and just
preg_replace()it all at once in_download_messages(). That would add additional memory overhead though.