Skip to:
Content

BuddyPress.org

Ticket #7674: 7674.01.patch

File 7674.01.patch, 1.2 KB (added by r-a-y, 6 years ago)
  • src/bp-core/bp-core-attachments.php

     
    265265        }
    266266
    267267        // Make sure the file path is safe.
    268         if ( 0 !== validate_file( $r['image'] ) ) {
     268        if ( 1 === validate_file( $r['image'] ) ) {
    269269                return false;
    270270        }
    271271
     
    447447        $type_subdir = $r['object_dir'] . '/' . $r['item_id'] . '/' . $r['type'];
    448448        $type_dir    = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $type_subdir;
    449449
    450         if ( 0 !== validate_file( $type_dir ) || ! is_dir( $type_dir ) ) {
     450        if ( 1 === validate_file( $type_dir ) || ! is_dir( $type_dir ) ) {
    451451                return $attachment_data;
    452452        }
    453453
     
    13031303        $cover_subdir = $object_data['dir'] . '/' . $bp_params['item_id'] . '/cover-image';
    13041304        $cover_dir    = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $cover_subdir;
    13051305
    1306         if ( 0 !== validate_file( $cover_dir ) || ! is_dir( $cover_dir ) ) {
     1306        if ( 1 === validate_file( $cover_dir ) || ! is_dir( $cover_dir ) ) {
    13071307                // Upload error response.
    13081308                bp_attachments_json_response( false, $is_html4, array(
    13091309                        'type'    => 'upload_error',