Invalid handling of attachment file paths
-
In version 1.2 of WP Offload S3 Lite, there is something wrong with upload_attachment_to_s3() function.
If $post_id equals null, the function returns an error, even if the upload to S3 was successful.
Row 1016 of amazon-s3-and-cloudfront.php:
$file_paths = AS3CF_Utils::get_attachment_file_paths( $post_id, false, $data );In this case, the return value of the function is array( ‘original’ => false ).
Later on, this leads to an entry being added to $upload_errors, thus causing the function to fail.
A simple fix (not sure if this is the best one) is to change the line above to:
$file_paths = ($post_id != null) ? AS3CF_Utils::get_attachment_file_paths( $post_id, false, $data ) : array();
- The topic ‘Invalid handling of attachment file paths’ is closed to new replies.