fix bug in cache path

pull/41/head
qkqpttgf 2020-03-22 15:31:29 +08:00 committed by GitHub
parent 6aeb7c483c
commit 6f1e9bf357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -935,6 +935,7 @@ function MSAPI($method, $path, $data = '', $access_token)
function fetch_files($path = '/') function fetch_files($path = '/')
{ {
global $exts; global $exts;
if (substr($path,-1)=='/') $path=substr($path,0,-1);
$path1 = path_format($path); $path1 = path_format($path);
$path = path_format($_SERVER['list_path'] . path_format($path)); $path = path_format($_SERVER['list_path'] . path_format($path));
if (!($files = getcache('path_' . $path))) { if (!($files = getcache('path_' . $path))) {
@ -944,13 +945,13 @@ function fetch_files($path = '/')
$pos = splitlast($path, '/'); $pos = splitlast($path, '/');
$parentpath = $pos[0]; $parentpath = $pos[0];
$filename = $pos[1]; $filename = $pos[1];
if ($parentfiles = getcache('path_' . $parentpath. '/')) { if ($parentfiles = getcache('path_' . $parentpath)) {
if (isset($parentfiles['children'][$filename]['@microsoft.graph.downloadUrl'])) { if (isset($parentfiles['children'][$filename]['@microsoft.graph.downloadUrl'])) {
if (in_array(splitlast($filename,'.')[1], $exts['txt'])) { if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) { if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
$content1 = curl_request($parentfiles['children'][$filename]['@microsoft.graph.downloadUrl']); $content1 = curl_request($parentfiles['children'][$filename]['@microsoft.graph.downloadUrl']);
$parentfiles['children'][$filename]['content'] = $content1; $parentfiles['children'][$filename]['content'] = $content1;
savecache('path_' . $parentpath. '/', $parentfiles); savecache('path_' . $parentpath, $parentfiles);
} }
} }
return $parentfiles['children'][$filename]; return $parentfiles['children'][$filename];