Skip to content

Commit 7bb0e98

Browse files
committed
Fix alt text stripping accents and single quotes
The altTextFrom method doesn't work well for non english characters and accents, it also uppercases every word which is weird
1 parent 8611299 commit 7bb0e98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Models/Media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public function altTextFrom($filename)
4949
{
5050
$filename = pathinfo($filename, PATHINFO_FILENAME);
5151
if (Str::endsWith($filename, '@2x')) {
52-
$filename = substr($filename, 0, -2);
52+
$filename = substr($filename, 0, -3);
5353
}
5454

55-
return ucwords(preg_replace('/[^a-zA-Z0-9]/', ' ', sanitizeFilename($filename)));
55+
return Str::ucfirst(preg_replace('/-_/', ' ', sanitizeFilename($filename)));
5656
}
5757

5858
public function canDeleteSafely()

0 commit comments

Comments
 (0)