return json with content-type
This commit is contained in:
+3
-3
@@ -191,7 +191,6 @@ 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 (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
|
|
||||||
$files['type'] = 'folder';
|
$files['type'] = 'folder';
|
||||||
$files['childcount'] = count($disktags);
|
$files['childcount'] = count($disktags);
|
||||||
$files['showname'] = 'root';
|
$files['showname'] = 'root';
|
||||||
@@ -202,8 +201,9 @@ function main($path)
|
|||||||
}
|
}
|
||||||
if ($_GET['json']) {
|
if ($_GET['json']) {
|
||||||
// return a json
|
// return a json
|
||||||
return output(json_encode($files));
|
return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
|
||||||
}
|
}
|
||||||
|
if (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
|
||||||
} else {
|
} else {
|
||||||
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
|
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
|
||||||
//$pos = strpos($path, '/');
|
//$pos = strpos($path, '/');
|
||||||
@@ -331,7 +331,7 @@ function main($path)
|
|||||||
|
|
||||||
if ($_GET['json']) {
|
if ($_GET['json']) {
|
||||||
// return a json
|
// return a json
|
||||||
return output(json_encode($files));
|
return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
|
||||||
}
|
}
|
||||||
// random file
|
// random file
|
||||||
if (isset($_GET['random'])&&$_GET['random']!=='') {
|
if (isset($_GET['random'])&&$_GET['random']!=='') {
|
||||||
|
|||||||
Reference in New Issue
Block a user