Skip to content

Commit

Permalink
Merge pull request #32 from muglug/patch-1
Browse files Browse the repository at this point in the history
Simplify getting basename for path
  • Loading branch information
ssandler authored Nov 17, 2021
2 parents a70536c + 46ccd8d commit 69530ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AttrTransform/ImgRequired.hack
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier\HTMLPurifier_A
if ($src) {
$alt = $config->def->defaults['Attr.DefaultImageAlt'];
if ($alt === '') {
$src_path = new File\Path((string)$attr['src']);
$attr['alt'] = $src_path->getBaseName();
$src_path = (string)$attr['src'];
$attr['alt'] = \basename($src_path);
} else {
$attr['alt'] = $alt;
}
Expand Down

0 comments on commit 69530ae

Please sign in to comment.