Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

支持隐藏文件夹与文件 #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
支持隐藏文件夹与文件,"."开头的文件与文件夹将不会被列出,"."开头的文件夹只能直接访问文件
  • Loading branch information
zanjie1999 authored Feb 26, 2023
commit 5bb8d5dd162fe7b178ed676e2991e91a766fd3b4
2 changes: 2 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ function handleRequest($url, $returnUrl = false, $requestForFile = false)
handleFile($data["@microsoft.graph.downloadUrl"], $data);/*下载文件*/
}
} else if (array_key_exists('value', $data)) {/*返回的是目录*/
if (strpos($path, '/.') !== false) die('Access denied');/*阻止.开头的文件夹列出目录*/
/*渲染目录,2021.11.11修复空目录返回空白的bug*/
$render = renderFolderIndex(($data['value'] ? $data['value'] : []), parsePath($url));
return $render;
Expand Down Expand Up @@ -514,6 +515,7 @@ function renderFolderIndex($items, $isIndex)
$jsonArr['msg'] = 'Password required,please post the form: requestfolder=' . $folderMd5 . '&password=<thepassword>';
} else {
foreach ($items as $v) {
if (substr($v['name'], 0, 1) == '.') continue;
if (isset($v['folder'])) {/*是目录*/
$jsonArr['folders'][] = ['createdDateTime' => $v['createdDateTime'], 'lastModifiedDateTime' => $v['lastModifiedDateTime'], 'name' => $v['name'], 'size' => $v['size'], 'link' => processHref($v['name'] . '/')];
$itemRender .= item("folder", $v['name'], $v, $v['size'], processHref($v['name'] . '/'));
Expand Down