Skip to content

Commit 7dbbc44

Browse files
committed
Fix PHPStan error
1 parent bc693e3 commit 7dbbc44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

includes/Abilities/Image/Import_Base64_Image.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,14 @@ protected function import_image( string $data, array $args = array() ) {
294294
);
295295
}
296296

297+
$attached_file = get_attached_file( $attachment_id );
298+
$filename = $attached_file ? basename( $attached_file ) : '';
299+
297300
// Return attachment data.
298301
return array(
299302
'id' => $attachment_id,
300303
'url' => wp_get_attachment_url( $attachment_id ),
301-
'filename' => basename( get_attached_file( $attachment_id ) ),
304+
'filename' => $filename,
302305
'title' => $attachment->post_title,
303306
'description' => $attachment->post_content,
304307
'alt_text' => get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ),

0 commit comments

Comments
 (0)