diff --git a/components/Avatar/Controller/Avatar.php b/components/Avatar/Controller/Avatar.php index 302a9db4d8..87d7350eb4 100644 --- a/components/Avatar/Controller/Avatar.php +++ b/components/Avatar/Controller/Avatar.php @@ -106,7 +106,7 @@ class Avatar extends Controller } else { throw new ClientException('Invalid form'); } - $attachment = GSFile::validateAndStoreAttachment($sfile, Common::config('avatar', 'dir'), $title = null, $is_local = true, $use_unique = $gsactor_id); + $attachment = GSFile::validateAndStoreFileAsAttachment($sfile, Common::config('avatar', 'dir'), $title = null, $is_local = true, $use_unique = $gsactor_id); $old_attachment = null; $avatar = DB::find('avatar', ['gsactor_id' => $gsactor_id]); // Must get old id before inserting another one diff --git a/components/Posting/Posting.php b/components/Posting/Posting.php index 13158288d7..65790ad0c2 100644 --- a/components/Posting/Posting.php +++ b/components/Posting/Posting.php @@ -115,7 +115,7 @@ END; $processed_attachments = []; foreach ($attachments as $f) { - $processed_attachments[] = GSFile::validateAndStoreAttachment( + $processed_attachments[] = GSFile::validateAndStoreFileAsAttachment( $f, Common::config('attachments', 'dir'), Security::sanitize($f->getClientOriginalName()), is_local: true, actor_id: $actor_id @@ -125,7 +125,7 @@ END; $matched_urls = []; preg_match_all(self::URL_REGEX, $content, $matched_urls, PREG_SET_ORDER); foreach ($matched_urls as $match) { - $processed_attachments[] = GSFile::validateAndStoreURL($match[0]); + $processed_attachments[] = GSFile::validateAndStoreURLAsAttachment($match[0]); } DB::persist($note); diff --git a/src/Core/GSFile.php b/src/Core/GSFile.php index aaaf5939ae..50b39e86f5 100644 --- a/src/Core/GSFile.php +++ b/src/Core/GSFile.php @@ -38,11 +38,11 @@ class GSFile /** * Perform file validation (checks and normalization) and store the given file */ - public static function validateAndStoreAttachment(SymfonyFile $sfile, - string $dest_dir, - ?string $title = null, - bool $is_local = true, - int $actor_id = null): Attachment + public static function validateAndStoreFileAsAttachment(SymfonyFile $sfile, + string $dest_dir, + ?string $title = null, + bool $is_local = true, + int $actor_id = null): Attachment { Event::handle('HashFile', [$sfile->getPathname(), &$hash]); // The following properly gets the mimetype with `file` or other @@ -69,7 +69,7 @@ class GSFile * * @throws \InvalidArgumentException */ - public static function validateAndStoreURL(string $url): Attachment + public static function validateAndStoreURLAsAttachment(string $url): Attachment { if (Common::isValidHttpUrl($url)) { $head = HTTPClient::head($url);