Bug 37918 - Properly encode email subjects in mailto: links
Summary: Properly encode email subjects in mailto: links
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-13 14:05 UTC by Katrin Fischer
Modified: 2025-01-15 15:21 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 37918: Add email_header template toolkit filter (4.92 KB, patch)
2024-09-16 09:31 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37918: Add email_header template toolkit filter (4.97 KB, patch)
2024-09-26 15:56 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 37918: Remove the new dependency (1.51 KB, patch)
2025-01-15 15:20 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2024-09-13 14:05:38 UTC
There are some places in Koha where we use mailto: links with a subject line. 
An example is the email link added by bug 36595.

I believe we need to take a closer look at making sure we are encoding the subject line correctly.

Also need to make sure to not include untranslatable and therefore hardcoded bits into the subject messages.
Comment 1 Martin Renvoize (ashimema) 2024-09-13 14:13:15 UTC
So, on my quick research I reckon we need a new TT filter to make sure subjects are properly RFC2047 encoded.

We should be able to add that fairly trivially using Encode::MIME::Header I think.
Comment 2 Martin Renvoize (ashimema) 2024-09-16 09:31:51 UTC
Created attachment 171518 [details] [review]
Bug 37918: Add email_header template toolkit filter

This patch adds a new email_header TT filter to properly encode strings
according to RFC2047 as per the email specification.  This allows
developers to set default subjects in mailto links with the correct
encoding.
Comment 3 Shi Yao Wang 2024-09-26 15:56:27 UTC
Created attachment 171994 [details] [review]
Bug 37918: Add email_header template toolkit filter

This patch adds a new email_header TT filter to properly encode strings
according to RFC2047 as per the email specification.  This allows
developers to set default subjects in mailto links with the correct
encoding.

Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Comment 4 Shi Yao Wang 2024-09-26 15:58:49 UTC
Assuming I only needed to make sure the test passes for the sign-off.

Should we include refactoring of mailto with subject in this bug?
Comment 5 Martin Renvoize (ashimema) 2025-01-07 14:14:00 UTC
Yes indeed, that was the next step here.
Comment 6 Jonathan Druart 2025-01-15 15:20:29 UTC
Created attachment 176576 [details] [review]
Bug 37918: Remove the new dependency
Comment 7 Jonathan Druart 2025-01-15 15:20:40 UTC
Do we really need the new dep?
Comment 8 Jonathan Druart 2025-01-15 15:21:33 UTC
24 use Encode::MIME::Header;

but you are not using it?