diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index ea4ae947cc..227210b141 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
@@ -788,6 +788,13 @@ public function prepare_item_for_response( $post, $request ) {
 			} else {
 				$data['media_details']['sizes'] = new stdClass;
 			}
+
+			if ( ! isset( $data['media_details']['filesize'] ) ) {
+				$attached_file = get_attached_file( $post->ID );
+				if ( is_readable( $attached_file ) ) {
+					$data['media_details']['filesize'] = filesize( $attached_file );
+				}
+			}
 		}
 
 		if ( in_array( 'post', $fields, true ) ) {
