Merge pull request #6412 from pixelfed/shleeable-patch-11

Bugfix: Fix file check for `my.vacation.2023.jpg` or filenames with multiple dots.
pull/6441/head
dansup 8 months ago committed by GitHub
commit 8bb90c73ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -302,10 +302,12 @@ class Image
public function setBaseName($basePath, $thumbnail, $extension)
{
$path = explode('.', $basePath);
$name = ($thumbnail == true) ? $path[0].'_thumb' : $path[0];
$basePath = "{$name}.{$extension}";
$pathInfo = pathinfo($basePath);
$dir = isset($pathInfo['dirname']) && $pathInfo['dirname'] !== '.' ? $pathInfo['dirname'] . '/' : '';
$filename = $pathInfo['filename'];
$name = ($thumbnail == true) ? $filename . '_thumb' : $filename;
$basePath = $dir . $name . '.' . $extension;
return ['path' => $basePath, 'png' => false];
}

Loading…
Cancel
Save