From 5e0626e46945edc4118e748dad2e2ded3461aa82 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 4 Aug 2020 15:24:21 +0800 Subject: [PATCH] in multy disk, only json can visit root, other will jump to first disk --- common.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/common.php b/common.php index b1c7e25..cab906d 100644 --- a/common.php +++ b/common.php @@ -251,17 +251,16 @@ function main($path) // echo 'count$disk:'.count($disktags); if (count($disktags)>1) { if ($path=='/'||$path=='') { - $files['folder']['childCount'] = count($disktags); - foreach ($disktags as $disktag) { - $files['children'][$disktag]['folder'] = 1; - $files['children'][$disktag]['name'] = $disktag; - } if ($_GET['json']) { // return a json + $files['folder']['childCount'] = count($disktags); + foreach ($disktags as $disktag) { + $files['children'][$disktag]['folder'] = 1; + $files['children'][$disktag]['name'] = $disktag; + } return files_json($files); - } - return render_list($path, $files); - //return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); + } // else return render_list($path, $files); + return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); } $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0]; //$pos = strpos($path, '/'); -- GitLab