Bug 4658 - Headers unfolded incorrectly in message view
Summary: Headers unfolded incorrectly in message view
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: UI/Message View (show other bugs)
Version: 3.19.0
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2023-01-21 23:14 UTC by Viatrix
Modified: 2023-02-08 13:18 UTC (History)
0 users

See Also:


Attachments
Fixes message view's incorrect header unfolding. (354 bytes, patch)
2023-01-23 04:56 UTC, Viatrix
no flags Details | Diff
Fixes message view's incorrect header unfolding WHILE keeping headers unmodified on redirect. (1.73 KB, patch)
2023-01-23 05:54 UTC, Viatrix
no flags Details | Diff

Description Viatrix 2023-01-21 23:14:25 UTC
Steps to reproduce:
1. Compose a message where any header field (such as Subject: or To:) is long enough to be folded (over 80 or so characters)
2. View the message's header fields in the message view.

Actual results:
The header field is displayed with spaces where CRLF was used for folding (results in two consecutive spaces where there should be one space)

Expected results:
The CRLFs used for folding are not displayed in any way (per RFC 5322, section 2.2.3).

The message list pane appears to display the headers as expected.
Comment 1 Viatrix 2023-01-23 03:34:56 UTC
Clarification: The length of a header field is not the sole determinant of whether this bug will manifest. Other factors include whether the header contains whitespace and whether the CRLF WSP is preceded and proceeded by an "encoded-word" as defined in RFC 2047.

Test cases:

Composing a message with the subject
"a long subject. very long. quite long. so long, it might need to be wrapped"
displays an extra space between "be" and "wrapped" in the message view, due to this bug.

Composing a message to "example@example.com", "example@example.net", "example@example.org" and "example@example.test" displays an extra space after "example.org," in the message view, due to this bug.
Comment 2 Viatrix 2023-01-23 04:56:57 UTC
Created attachment 2318 [details]
Fixes message view's incorrect header unfolding.

(the timestamps are weird because I created the folders after testing the fix)
I must admit I don't know why this argument was originally FALSE, but after this change I see no unintentional effects.
Comment 3 Viatrix 2023-01-23 05:23:05 UTC
After checking the commit in which said line was added, the reason it was originally FALSE appears to have been an æsthetic choice only:

>       * src/procheader.[ch]
>               o added procheader_get_one_field_asis() that does not do
>                 unfolding
>               o fix procheader_get_header_array_asis() to use the above,
>                 fixing ugliness of headers in textview

meaning it shouldn't break anything by being changed, I think.
Regardless of whether that commit was "fixing ugliness" at the time, its only effect now is having incorrect spaces in headers.
Comment 4 Viatrix 2023-01-23 05:29:26 UTC
ack no wait after that there's
>       * src/compose.c
>               o don't unfold headers when redirecting.  
That might be affected by my change. However I don't know whether that's significant.
Comment 5 Viatrix 2023-01-23 05:54:00 UTC
Created attachment 2319 [details]
Fixes message view's incorrect header unfolding WHILE keeping headers unmodified on redirect.

In case keeping headers unmodified on redirect is important, this patch fixes the incorrect displaying while not affecting how the headers are handled when redirecting.
The function "procheader_get_header_array_asis" I renamed to "procheader_get_header_array" since it is no longer "as-is".
Comment 6 Paul 2023-02-08 13:18:54 UTC
now fixed in git. thanks for the patch (it just missed the update to procheader.h)

Note You need to log in before you can comment on or make changes to this bug.