• 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();

Viewing 1 replies (of 1 total)
  • Plugin Contributor Evan Mattson

    (@aaemnnosttv)

    Hi there, and thanks for the report! For bug reports, please create an issue on the plugin’s repository on GitHub.

    Before you do, you should look into why the $post_id is being passed as null, as this should never happen under normal circumstances. It could be something else is throwing a wrench in things before it ever gets to our upload method.

Viewing 1 replies (of 1 total)
  • The topic ‘Invalid handling of attachment file paths’ is closed to new replies.