Skip to:
Content

BuddyPress.org

Ticket #7674: .patch

File .patch, 2.1 KB (added by wordplus, 7 years ago)
  • bp-core/bp-core-attachments.php

     
    13141314        $cover_subdir = $object_data['dir'] . '/' . $bp_params['item_id'] . '/cover-image';
    13151315        $cover_dir    = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $cover_subdir;
    13161316
    1317         if ( 0 !== validate_file( $cover_dir ) || ! is_dir( $cover_dir ) ) {
     1317        if ( ! is_dir( $cover_dir ) ) {
    13181318                // Upload error response.
    13191319                bp_attachments_json_response( false, $is_html4, array(
    13201320                        'type'    => 'upload_error',
  • bp-core/classes/class-bp-attachment-cover-image.php

     
    3838                        // Specific errors for cover images.
    3939                        'upload_error_strings'  => array(
    4040                                11  => sprintf( __( 'That image is too big. Please upload one smaller than %s', 'buddypress' ), size_format( $max_upload_file_size ) ),
    41                                 12  => sprintf( _n( 'Please upload only this file type: %s.', 'Please upload only these file types: %s.', count( $allowed_types ), 'buddypress' ), self::get_cover_image_types( $allowed_types ) ),
     41                12  => sprintf( _n( 'Please upload only this file type: %s.', 'Please upload only these file types: %s.', count( $allowed_types ), 'buddypress' ), self::get_cover_image_types( $allowed_types ) ),
     42                13  => __( 'There was a problem uploading the cover image.', 'buddypress' )
    4243                        ),
    4344                ) );
    4445        }
     
    7778                // File size is too big.
    7879                if ( $file['size'] > $this->original_max_filesize ) {
    7980                        $file['error'] = 11;
    80 
    8181                // File is of invalid type.
    8282                } elseif ( ! bp_attachments_check_filetype( $file['tmp_name'], $file['name'], bp_attachments_get_allowed_mimes( 'cover_image' ) ) ) {
    8383                        $file['error'] = 12;
    84                 }
     84                } else if( 0 !== validate_file( $file['name'] ) ) {
     85            $file['error'] = 13;
     86        }
    8587
    8688                // Return with error code attached.
    8789                return $file;