Plugin Directory

Changeset 2414811


Ignore:
Timestamp:
11/08/2020 05:50:01 PM (5 years ago)
Author:
stooit
Message:

Ensure file routes are pushed as binary.

Location:
quant
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • quant/tags/1.1.0/src/seed/CustomRoutesBatch.php

    r2414596 r2414811  
    3636
    3737            foreach ($routes as $i => $route) {
     38
     39                // Check for file on disk, disallow paths outside root.
     40                $file = ABSPATH . strtok($route, '?');
     41                if (file_exists($file) && is_file($file) && strpos($file, '..') === false) {
     42                    $this->push( new Quant_WP_Batch_Item( $i, array( 'route' => $route, 'is_file' => true ) ) );
     43                    continue;
     44                }
     45
     46                // Assume content route.
    3847                $this->push( new Quant_WP_Batch_Item( $i, array( 'route' => $route ) ) );
    3948            }
     
    6170            $route = $item->get_value( 'route' );
    6271            $is_404 = $item->get_value( 'is_404' );
     72            $is_file = $item->get_value( 'is_file' );
     73
     74            if ($is_file) {
     75                $file = ABSPATH . strtok($route, '?');
     76                $this->client->file($route, $file);
     77                return true;
     78            }
    6379
    6480            if ($is_404) {
  • quant/trunk/quant.php

    r2414596 r2414811  
    66 * Author: Stuart Rowlands
    77 * Plugin URI: https://www.quantcdn.io
    8  * Version: 1.0.0
     8 * Version: 1.1.0
    99 * License: GPL-2.0+
    1010 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
  • quant/trunk/src/seed/CustomRoutesBatch.php

    r2391375 r2414811  
    3636
    3737            foreach ($routes as $i => $route) {
     38
     39                // Check for file on disk, disallow paths outside root.
     40                $file = ABSPATH . strtok($route, '?');
     41                if (file_exists($file) && is_file($file) && strpos($file, '..') === false) {
     42                    $this->push( new Quant_WP_Batch_Item( $i, array( 'route' => $route, 'is_file' => true ) ) );
     43                    continue;
     44                }
     45
     46                // Assume content route.
    3847                $this->push( new Quant_WP_Batch_Item( $i, array( 'route' => $route ) ) );
    3948            }
     
    6170            $route = $item->get_value( 'route' );
    6271            $is_404 = $item->get_value( 'is_404' );
     72            $is_file = $item->get_value( 'is_file' );
     73
     74            if ($is_file) {
     75                $file = ABSPATH . strtok($route, '?');
     76                $this->client->file($route, $file);
     77                return true;
     78            }
    6379
    6480            if ($is_404) {
Note: See TracChangeset for help on using the changeset viewer.