Changeset 6163
- Timestamp:
- 11/23/2017 05:51:26 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-serve.php
r6022 r6163 35 35 */ 36 36 protected function determine_request() { 37 $zip = basename( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) ); 38 39 if ( ! preg_match( "!^(?P<slug>[a-z0-9-_]+)(\.(?P<version>.+?))?\.(?P<request_type>zip|checksums\.json)$!i", $zip, $m ) ) { 37 $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); 38 $zip = basename( $path ); 39 40 if ( preg_match( "!^(?P<slug>[a-z0-9-_]+)(\.(?P<version>.+?))?\.zip$!i", $zip, $m ) ) { 41 // ZIP 42 $checksum_request = false; 43 } elseif ( preg_match( "!^/plugin-checksums/(?P<slug>[a-z0-9-_]+)/(?P<version>.+?)(\.json)?$!i", $path, $m ) ) { 44 // Checksums 45 $checksum_request = true; 46 } else { 40 47 throw new Exception( __METHOD__ . ": Invalid URL." ); 41 48 } … … 51 58 } 52 59 53 if ( 'zip' == strtolower( $m['request_type'] ) ) { 54 $checksum_request = false; 55 } else { 56 $checksum_request = true; 57 58 // Checksum requests for 'trunk' are not possible. 59 if ( 'trunk' == $version ) { 60 throw new Exception( __METHOD__ . ": Checksum requests must include a version." ); 61 } 62 60 // Checksum requests for 'trunk' are not possible. 61 if ( $checksum_request && 'trunk' == $version ) { 62 throw new Exception( __METHOD__ . ": Checksum requests must include a version." ); 63 63 } 64 64
Note: See TracChangeset
for help on using the changeset viewer.