Skip to content

Commit

Permalink
Fix filename: no more double extension on download. (#2474)
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria authored Jun 25, 2024
1 parent 907a404 commit a0bcb4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Actions/Album/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private static function createZipTitle(Collection $albums): string
private static function createValidTitle(string $title): string
{
$validTitle = str_replace(self::BAD_CHARS, '', $title);
$validTitle = pathinfo($validTitle, PATHINFO_FILENAME);

return $validTitle !== '' ? $validTitle : 'Untitled';
}
Expand Down
1 change: 1 addition & 0 deletions app/Actions/Photo/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ protected function extractFileInfo(Photo $photo, DownloadVariantType $downloadVa
{
$validFilename = str_replace(self::BAD_CHARS, '', $photo->title);
$baseFilename = $validFilename !== '' ? $validFilename : 'Untitled';
$baseFilename = pathinfo($baseFilename, PATHINFO_FILENAME);

if ($downloadVariant === DownloadVariantType::LIVEPHOTOVIDEO) {
$disk = $photo->size_variants->getSizeVariant(SizeVariantType::ORIGINAL)->storage_disk->value;
Expand Down

0 comments on commit a0bcb4d

Please sign in to comment.