diff --git a/components/Avatar/Controller/Avatar.php b/components/Avatar/Controller/Avatar.php index 5d81b7fce5..510ffeebff 100644 --- a/components/Avatar/Controller/Avatar.php +++ b/components/Avatar/Controller/Avatar.php @@ -102,7 +102,13 @@ class Avatar extends Controller } else { throw new ClientException('Invalid form'); } - $attachment = GSFile::validateAndStoreFileAsAttachment($file, dest_dir: Common::config('avatar', 'dir'), is_local: true, actor_id: $gsactor_id); + $attachment = GSFile::validateAndStoreFileAsAttachment( + $file, + dest_dir: Common::config('avatar', 'dir'), + actor_id: $gsactor_id, + title: _m("Avatar for Actor {$gsactor_id}"), + is_local: true + ); // Must get old id before inserting another one $old_attachment = null; $avatar = DB::find('avatar', ['gsactor_id' => $gsactor_id]); diff --git a/components/Posting/Posting.php b/components/Posting/Posting.php index dbb7198fe2..345fcc62cd 100644 --- a/components/Posting/Posting.php +++ b/components/Posting/Posting.php @@ -116,9 +116,11 @@ END; $processed_attachments = []; foreach ($attachments as $f) { // where $f is a Symfony\Component\HttpFoundation\File\UploadedFile $processed_attachments[] = GSFile::validateAndStoreFileAsAttachment( - $f, Common::config('attachments', 'dir'), - Security::sanitize($f->getClientOriginalName()), - is_local: true, actor_id: $actor_id + $f, + dest_dir: Common::config('attachments', 'dir'), + actor_id: $actor_id, + title: Security::sanitize($f->getClientOriginalName()), + is_local: true ); } diff --git a/src/Core/GSFile.php b/src/Core/GSFile.php index 770e55dc3f..901cddc8e0 100644 --- a/src/Core/GSFile.php +++ b/src/Core/GSFile.php @@ -65,9 +65,9 @@ class GSFile */ public static function validateAndStoreFileAsAttachment(SplFileInfo $file, string $dest_dir, + int $actor_id, ?string $title = null, - bool $is_local = true, - int $actor_id = null): Attachment + bool $is_local = true): Attachment { $hash = null; Event::handle('HashFile', [$file->getPathname(), &$hash]);