From ad6703ca40604a0ded1c321178aade0437f560f0 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 3 Jan 2020 18:01:36 +0800 Subject: [PATCH] Update index.php --- index.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 1b3b204..5f3fee0 100644 --- a/index.php +++ b/index.php @@ -140,7 +140,7 @@ function main($path) if ( isset($files['folder']) || isset($files['file']) ) { return render_list($path, $files); } else { - return output('
' . $files['error']['message'] . '
', 404); + return message('
' . $files['error']['message'] . '
', $files['error']['code'], $files['error']['stat']); } } @@ -161,7 +161,7 @@ function list_files($path) $_SERVER['retry']++; if ($_SERVER['retry'] < 3) { return list_files($path); - } else return ''; + } else return $files; } } @@ -505,9 +505,12 @@ function fetch_files($path = '/') $cache->save('path_' . $path, $files, 3300); } } - } else {//,"message":"'.$arr['body'].'" + if (isset($files['error'])) { + $files['error']['stat'] = $arr['stat']; + } + } else { error_log($arr['body']); - $files = json_decode( '{"unknownError":{ "stat":'.$arr['stat'].'}}', true); + $files = json_decode( '{"unknownError":{ "stat":'.$arr['stat'].',"message":"'.$arr['body'].'"}}', true); } } return $files;