harishanchu / Laravel-FTP

A simple Laravel 4/5/6/7 ftp service provider with basic ftp methods.
220 stars 87 forks source link

Bug with filenames with more than one space #29

Open eporral1 opened 9 years ago

eporral1 commented 9 years ago

Hi, I've found a bug when trying to import files with more that one space in the name.

Here is a fix :

public function getDirListingDetailed($directory = '.') { if (is_array($children = @ftp_rawlist($this->connectionId, $directory))) {

        $items = array();

        foreach ($children as $child) {
            $chunks = preg_split("/\s+/", substr($child,0,61));
            $name = substr($child,62);

            list(
                $item['rights'],
                $item['number'],
                $item['user'],
                $item['group'],
                $item['size'],
                $item['month'],
                $item['day'],
                $item['time']
            ) = $chunks;

            $item['type'] = $chunks[0]{0} === 'd' ? static::TYPE_DIR : static::TYPE_FILE;
            array_splice($chunks, 0, 8);

            $items[implode(" ", $chunks).$name] = $item;
        }
        return $items;
    }

    return false;

}

Coould you include this fix?

Thanks!!