Skip to content

Fix body truncation logic in Driver.php#10

Merged
ralflang merged 2 commits intoFRAMEWORK_6_0from
fix/Correct_substring_logic
Mar 30, 2026
Merged

Fix body truncation logic in Driver.php#10
ralflang merged 2 commits intoFRAMEWORK_6_0from
fix/Correct_substring_logic

Conversation

@TDannhauer
Copy link
Copy Markdown
Contributor

Mnemo: fix ActiveSync HTML note body truncation (toASNote) Summary
Corrects the arguments passed to Horde_String::substr() when truncating HTML note bodies for ActiveSync export. The HTML branch mistakenly passed the truncation size as the start offset (second parameter) instead of the length (third parameter), unlike the plain-text branch.

Problem
For clients that request HTML body preferences with a truncationsize, truncated notes could end up with the wrong slice of text (from offset truncationsize to the end) or an empty body when the note was shorter than the truncation size—especially visible after stricter mb_substr / multibyte handling. That could make notes appear not to sync or show up blank on the device.

Change
Use Horde_String::substr($memo['body'], 0, $truncationsize) for the HTML truncation path, matching the plain-text path.

Files
lib/Driver.php — Mnemo_Driver::toASNote()

Mnemo: fix ActiveSync HTML note body truncation (toASNote)
Summary
Corrects the arguments passed to Horde_String::substr() when truncating HTML note bodies for ActiveSync export. The HTML branch mistakenly passed the truncation size as the start offset (second parameter) instead of the length (third parameter), unlike the plain-text branch.

Problem
For clients that request HTML body preferences with a truncationsize, truncated notes could end up with the wrong slice of text (from offset truncationsize to the end) or an empty body when the note was shorter than the truncation size—especially visible after stricter mb_substr / multibyte handling. That could make notes appear not to sync or show up blank on the device.

Change
Use Horde_String::substr($memo['body'], 0, $truncationsize) for the HTML truncation path, matching the plain-text path.

Files
lib/Driver.php — Mnemo_Driver::toASNote()
@TDannhauer TDannhauer requested a review from ralflang March 30, 2026 16:57
- Add use statement for Horde\Util\HordeString
- Replace FQCN Horde_String:: with imported HordeString::
- Use named parameters in substr() calls for clarity
@ralflang ralflang merged commit 97c7725 into FRAMEWORK_6_0 Mar 30, 2026
0 of 2 checks passed
@ralflang ralflang deleted the fix/Correct_substring_logic branch March 30, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants