mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复访问http目录下索引文件相关的bug
This commit is contained in:
parent
08299b6652
commit
2e05119df1
@ -119,7 +119,7 @@ static string searchIndexFile(const string &dir){
|
|||||||
}
|
}
|
||||||
set<string> setFile;
|
set<string> setFile;
|
||||||
while ((pDirent = readdir(pDir)) != NULL) {
|
while ((pDirent = readdir(pDir)) != NULL) {
|
||||||
static set<const char *, StrCaseCompare> indexSet = {"index.html", "index.htm", "index"};
|
static set<const char *, StrCaseCompare> indexSet = {"index.html", "index.htm"};
|
||||||
if (indexSet.find(pDirent->d_name) != indexSet.end()) {
|
if (indexSet.find(pDirent->d_name) != indexSet.end()) {
|
||||||
string ret = pDirent->d_name;
|
string ret = pDirent->d_name;
|
||||||
closedir(pDir);
|
closedir(pDir);
|
||||||
@ -571,11 +571,14 @@ void HttpFileManager::onAccessPath(Session &sender, Parser &parser, const HttpFi
|
|||||||
if (File::is_dir(file_path.data())) {
|
if (File::is_dir(file_path.data())) {
|
||||||
auto indexFile = searchIndexFile(file_path);
|
auto indexFile = searchIndexFile(file_path);
|
||||||
if (!indexFile.empty()) {
|
if (!indexFile.empty()) {
|
||||||
//发现该文件夹下有index文件
|
// 发现该文件夹下有index文件
|
||||||
file_path = pathCat(file_path, indexFile);
|
file_path = pathCat(file_path, indexFile);
|
||||||
parser.setUrl(pathCat(parser.url(), indexFile));
|
if (!File::is_dir(file_path.data())) {
|
||||||
accessFile(sender, parser, media_info, file_path, cb);
|
// 不是文件夹
|
||||||
return;
|
parser.setUrl(pathCat(parser.url(), indexFile));
|
||||||
|
accessFile(sender, parser, media_info, file_path, cb);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
string strMenu;
|
string strMenu;
|
||||||
//生成文件夹菜单索引
|
//生成文件夹菜单索引
|
||||||
|
Loading…
Reference in New Issue
Block a user