From 1d4a5817fc9fc40d248426454f0d0925da8c3b29 Mon Sep 17 00:00:00 2001 From: asoul-rec Date: Wed, 19 Apr 2023 08:27:27 -0400 Subject: [PATCH 1/4] Update Onedrive.php follow the 302 when curl the DownurlStrName --- disk/Onedrive.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/disk/Onedrive.php b/disk/Onedrive.php index 52df104..ed9e0e4 100644 --- a/disk/Onedrive.php +++ b/disk/Onedrive.php @@ -121,7 +121,10 @@ class Onedrive { if (in_array(strtolower(splitlast($files['name'],'.')[1]), $exts['txt'])) { if ($files['size']<1024*1024) { if (!(isset($files['content'])&&$files['content']['stat']==200)) { - $content1 = curl('GET', $files[$this->DownurlStrName]); + $content1 = curl('GET', $files[$this->DownurlStrName], '', [], 1); + if ($content1['stat'] == 302) { + $content1 = curl('GET', $content1["returnhead"]["location"]); + } $tmp = null; $tmp = json_decode(json_encode($content1), true); if ($tmp['body']===null) { From 238befc7ff5253cd386cef665ed4906b4a8b41f4 Mon Sep 17 00:00:00 2001 From: asoul-rec Date: Wed, 19 Apr 2023 08:31:13 -0400 Subject: [PATCH 2/4] Update common.php the ["returnhead"]["Location"] of curl return value seems not existed, change to ["returnhead"]["location"] --- common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.php b/common.php index 256b282..5eeb974 100644 --- a/common.php +++ b/common.php @@ -2313,7 +2313,7 @@ function render_list($path = '', $files = []) $tmp = curl('GET', $file_path, '', [], 1); if ($tmp['stat']==302) { error_log1(json_encode($tmp)); - $tmp = curl('GET', $tmp["returnhead"]["Location"]); + $tmp = curl('GET', $tmp["returnhead"]["location"]); } if (!!$tmp['body']) $html = $tmp['body']; savecache('customTheme', $html, '', 9999); From 0e1d0b8a1050b2884b9756146d718e7704c9398c Mon Sep 17 00:00:00 2001 From: asoul-rec Date: Thu, 20 Apr 2023 08:31:05 -0400 Subject: [PATCH 3/4] Update common.php --- common.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common.php b/common.php index 5eeb974..2db4139 100644 --- a/common.php +++ b/common.php @@ -2310,11 +2310,7 @@ function render_list($path = '', $files = []) } else { if (!($html = getcache('customTheme'))) { $file_path = $theme; - $tmp = curl('GET', $file_path, '', [], 1); - if ($tmp['stat']==302) { - error_log1(json_encode($tmp)); - $tmp = curl('GET', $tmp["returnhead"]["location"]); - } + $tmp = curl('GET', $file_path, '', [], 0, 1); if (!!$tmp['body']) $html = $tmp['body']; savecache('customTheme', $html, '', 9999); } From 5bcbb76a9f242ea9840a537a5c1970adcd96db22 Mon Sep 17 00:00:00 2001 From: asoul-rec Date: Thu, 20 Apr 2023 08:33:32 -0400 Subject: [PATCH 4/4] Update Onedrive.php --- disk/Onedrive.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/disk/Onedrive.php b/disk/Onedrive.php index ed9e0e4..a47485a 100644 --- a/disk/Onedrive.php +++ b/disk/Onedrive.php @@ -62,7 +62,7 @@ class Onedrive { //savecache('path_' . $parentpath, $parentfiles, $this->disktag); if ($parentfiles['children'][$filename]['size']<1024*1024) { if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) { - $content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]); + $content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName], '', [], 0, 1); $tmp = null; $tmp = json_decode(json_encode($content1), true); if ($tmp['body']===null) { @@ -121,10 +121,7 @@ class Onedrive { if (in_array(strtolower(splitlast($files['name'],'.')[1]), $exts['txt'])) { if ($files['size']<1024*1024) { if (!(isset($files['content'])&&$files['content']['stat']==200)) { - $content1 = curl('GET', $files[$this->DownurlStrName], '', [], 1); - if ($content1['stat'] == 302) { - $content1 = curl('GET', $content1["returnhead"]["location"]); - } + $content1 = curl('GET', $files[$this->DownurlStrName], '', [], 0, 1); $tmp = null; $tmp = json_decode(json_encode($content1), true); if ($tmp['body']===null) {