[ATTACHMENTS][GSFile] Rename ValidateAndStore functions
This commit is contained in:
parent
a3860e6257
commit
c9090e6cee
@ -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
|
||||
|
@ -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);
|
||||
|
@ -38,7 +38,7 @@ class GSFile
|
||||
/**
|
||||
* Perform file validation (checks and normalization) and store the given file
|
||||
*/
|
||||
public static function validateAndStoreAttachment(SymfonyFile $sfile,
|
||||
public static function validateAndStoreFileAsAttachment(SymfonyFile $sfile,
|
||||
string $dest_dir,
|
||||
?string $title = null,
|
||||
bool $is_local = true,
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user