Make WordPress Core


Ignore:
Timestamp:
01/30/2024 02:21:47 PM (9 months ago)
Author:
jorbin
Message:

Uploads: Check for and verify ZIP archives.

Props costdev, peterwilsoncc, azaozz, tykoted, johnbillion, desrosj, afragen, jorbin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update.php

    r55641 r57388  
    154154
    155155        check_admin_referer( 'plugin-upload' );
     156
     157        if ( isset( $_FILES['pluginzip']['name'] ) && ! str_ends_with( strtolower( $_FILES['pluginzip']['name'] ), '.zip' ) ) {
     158            wp_die( __( 'Only .zip archives may be uploaded.' ) );
     159        }
    156160
    157161        $file_upload = new File_Upload_Upgrader( 'pluginzip', 'package' );
     
    302306
    303307        check_admin_referer( 'theme-upload' );
     308
     309        if ( isset( $_FILES['themezip']['name'] ) && ! str_ends_with( strtolower( $_FILES['themezip']['name'] ), '.zip' ) ) {
     310            wp_die( __( 'Only .zip archives may be uploaded.' ) );
     311        }
    304312
    305313        $file_upload = new File_Upload_Upgrader( 'themezip', 'package' );
Note: See TracChangeset for help on using the changeset viewer.