Skip to content

Commit 29e0255

Browse files
committed
fix: Fixed a regression caused by the removal of Stringy that caused an off by 1 error when saving truncated strings to the database ([#350](#350))
1 parent 287bf90 commit 29e0255

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/helpers/Text.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public static function truncate(string $string, int $length, string $substring =
4343

4444
if (!empty($string)) {
4545
$string = strip_tags($string);
46-
$result = StringHelper::truncate($string, $length, $substring);
46+
$adjustedLength = $length - strlen($substring);
47+
$result = StringHelper::truncate($string, $adjustedLength, $substring);
4748
}
4849

4950
return $result;

0 commit comments

Comments
 (0)