Symlink bug
-
Hi there,
I believe I’ve found and fixed a bug that is affecting this plugin.
‘lib/functions.php/’ line 538 and 543
The
$upload_dir['basedir']is not being expanded withrealpath()whilst the$cur_local_fileis. This makes thestr_replacecall fail when the upload folder is symlinked.Old code:
foreach ($files as $fileinfo) { $the_file = $fileinfo->getRealPath(); $file_path = pathinfo($the_file); if (!is_dir($the_file)) { if (isset($_SESSION['cdn']->api_settings->files_to_ignore)) { // File extensions ignored $ignore_files = explode(",", $_SESSION['cdn']->api_settings->files_to_ignore); if (!in_array($file_path['extension'], $ignore_files)) { $cur_local_file = $fileinfo->getRealPath(); $local_files[$i++] = array('fn' => trim(str_replace($upload_dir['basedir'], '', $cur_local_file), '/'), 'fs' => filesize($cur_local_file)); } } else { // No file extensions ignored $cur_local_file = $fileinfo->getRealPath(); $local_files[$i++] = array('fn' => trim(str_replace($upload_dir['basedir'], '', $cur_local_file), '/'), 'fs' => filesize($cur_local_file)); } } }New code:
foreach ($files as $fileinfo) { $the_file = $fileinfo->getRealPath(); $file_path = pathinfo($the_file); if (!is_dir($the_file)) { $upload_base_dir = realpath($upload_dir['basedir']); if (isset($_SESSION['cdn']->api_settings->files_to_ignore)) { // File extensions ignored $ignore_files = explode(",", $_SESSION['cdn']->api_settings->files_to_ignore); if (!in_array($file_path['extension'], $ignore_files)) { $cur_local_file = $fileinfo->getRealPath(); $local_files[$i++] = array('fn' => trim(str_replace($upload_base_dir, '', $cur_local_file), '/'), 'fs' => filesize($cur_local_file)); } } else { // No file extensions ignored $cur_local_file = $fileinfo->getRealPath(); $local_files[$i++] = array('fn' => trim(str_replace($upload_base_dir, '', $cur_local_file), '/'), 'fs' => filesize($cur_local_file)); } } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Symlink bug’ is closed to new replies.