Making WordPress.org

Changeset 13101


Ignore:
Timestamp:
01/10/2024 02:13:55 AM (16 months ago)
Author:
dd32
Message:

Theme Directory: Enforce the 10MB theme upload limit.

Fixes #5843.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php

    r13100 r13101  
    205205        }
    206206
     207        // Validate it's not too large.
     208        if ( $size > wp_max_upload_size() ) {
     209            return new WP_Error(
     210                'file_too_big',
     211                sprintf(
     212                    __( 'Maximum allowed file size: %s', 'wporg-themes' ),
     213                    esc_html( size_format( wp_max_upload_size() ) )
     214                )
     215            );
     216        }
     217
    207218        // Validate that the file is a ZIP file before processing it.
    208219        $check = wp_check_filetype_and_ext(
     
    288299
    289300        $valid_upload = $this->validate_upload( $file_upload );
    290         if ( ! $valid_upload ) {
     301        if ( is_wp_error( $valid_upload ) ) {
     302            return $valid_upload;
     303        } elseif ( ! $valid_upload ) {
    291304            return new WP_Error(
    292305                'invalid_input',
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php

    r13059 r13101  
    6464        if ( 'pre_upload_terms' === $code ) {
    6565            $terms_notice = "<div class='notice notice-error notice-large'><ul>{$notice_content}</ul></div>";
     66        } elseif ( is_wp_error( $messages ) ) {
     67            $notice = "<div class='notice notice-error notice-large'><ul>{$notice_content}</ul></div>";
    6668        } else {
    6769            $notice = "<div class='notice notice-warning notice-large'><ul>{$notice_content}</ul></div>";
Note: See TracChangeset for help on using the changeset viewer.