Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f78315c authored by cketti's avatar cketti
Browse files

Fix bug in `FlowedMessageUtils.deflow()`

Properly handle the case when a quoted flowed line is followed by an empty line.
parent 60baf4bd
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -45,11 +45,11 @@ public final class FlowedMessageUtils {
            String line = i < lines.length ? lines[i] : null;
            int actualQuoteDepth = 0;

            if (line != null && line.length() > 0) {
            if (line != null) {
                if (line.equals(RFC2646_SIGNATURE)) {
                    // signature handling (the previous line is not flowed)
                    resultLineFlowed = false;
                } else if (line.charAt(0) == RFC2646_QUOTE) {
                } else if (line.length() > 0 && line.charAt(0) == RFC2646_QUOTE) {
                    // Quote
                    actualQuoteDepth = 1;
                    while (actualQuoteDepth < line.length() && line.charAt(actualQuoteDepth) == RFC2646_QUOTE) {
@@ -74,7 +74,7 @@ public final class FlowedMessageUtils {
                }

                // if the previous was the last then it was not flowed
            } else if (line == null) {
            } else {
                resultLineFlowed = false;
            }

+0 −2
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ package com.fsck.k9.mail.internet

import com.fsck.k9.mail.crlf
import com.google.common.truth.Truth.assertThat
import org.junit.Ignore
import org.junit.Test

private const val DEL_SP_NO = false
@@ -98,7 +97,6 @@ class FlowedMessageUtilsTest {
        )
    }

    @Ignore("Fails because of a bug in the code. See GH-6029")
    @Test
    fun `deflow() with quoted text ending in space followed by empty line`() {
        val input = "> Quoted \r\n" +