From: Andreas F. <ba...@ph...> - 2009-07-22 03:03:12
|
Author: bantu Date: Wed Jul 22 03:02:45 2009 New Revision: 9822 Log: Also fix bug #46295 in ftp_fsock class. Modified: branches/phpBB-3_0_0/phpBB/includes/functions_transfer.php Modified: branches/phpBB-3_0_0/phpBB/includes/functions_transfer.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/functions_transfer.php (original) --- branches/phpBB-3_0_0/phpBB/includes/functions_transfer.php Wed Jul 22 03:02:45 2009 *************** *** 483,489 **** $item = str_replace('\\', '/', $item); $dir = str_replace('\\', '/', $dir); ! if (strpos($item, $dir) === 0) { $item = substr($item, strlen($dir)); } --- 483,489 ---- $item = str_replace('\\', '/', $item); $dir = str_replace('\\', '/', $dir); ! if (!empty($dir) && strpos($item, $dir) === 0) { $item = substr($item, strlen($dir)); } *************** *** 749,754 **** --- 749,768 ---- // Clear buffer $this->_check_command(); + // See bug #46295 - Some FTP daemons don't like './' + if ($dir === './' && empty($list)) + { + // Let's try some alternatives + $list = $this->_ls('.'); + + if (empty($list)) + { + $list = $this->_ls(''); + } + + return $list; + } + // Remove path if prepended foreach ($list as $key => $item) { *************** *** 756,762 **** $item = str_replace('\\', '/', $item); $dir = str_replace('\\', '/', $dir); ! if (strpos($item, $dir) === 0) { $item = substr($item, strlen($dir)); } --- 770,776 ---- $item = str_replace('\\', '/', $item); $dir = str_replace('\\', '/', $dir); ! if (!empty($dir) && strpos($item, $dir) === 0) { $item = substr($item, strlen($dir)); } |