in multy disk, only json can visit root, other will jump to first disk

pull/128/head v2.4
qkqpttgf 2020-08-04 15:24:21 +08:00 committed by GitHub
parent 9b88ee17cc
commit 5e0626e469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -251,17 +251,16 @@ function main($path)
// echo 'count$disk:'.count($disktags); // echo 'count$disk:'.count($disktags);
if (count($disktags)>1) { if (count($disktags)>1) {
if ($path=='/'||$path=='') { if ($path=='/'||$path=='') {
if ($_GET['json']) {
// return a json
$files['folder']['childCount'] = count($disktags); $files['folder']['childCount'] = count($disktags);
foreach ($disktags as $disktag) { foreach ($disktags as $disktag) {
$files['children'][$disktag]['folder'] = 1; $files['children'][$disktag]['folder'] = 1;
$files['children'][$disktag]['name'] = $disktag; $files['children'][$disktag]['name'] = $disktag;
} }
if ($_GET['json']) {
// return a json
return files_json($files); return files_json($files);
} } // else return render_list($path, $files);
return render_list($path, $files); return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
//return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
} }
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0]; $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
//$pos = strpos($path, '/'); //$pos = strpos($path, '/');