mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-21 05:06:10 +08:00
🐛 fix: #101 分次请求文件
This commit is contained in:
@ -18,7 +18,7 @@ server:
|
|||||||
password: password #用于重建目录
|
password: password #用于重建目录
|
||||||
ali_drive:
|
ali_drive:
|
||||||
api_url: https://api.aliyundrive.com/v2
|
api_url: https://api.aliyundrive.com/v2
|
||||||
max_files_count: 3000
|
max_files_count: 50 #重建目录时每次请求的文件
|
||||||
drives:
|
drives:
|
||||||
- refresh_token: xxx #refresh_token
|
- refresh_token: xxx #refresh_token
|
||||||
root_folder: root #根目录的file_id
|
root_folder: root #根目录的file_id
|
||||||
|
@ -27,7 +27,7 @@ func Path(c *gin.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// folder model not exist
|
// folder model not exist
|
||||||
if file == nil {
|
if file == nil {
|
||||||
c.JSON(200, MetaResponse(404, "path not found."))
|
c.JSON(200, MetaResponse(404, "path not found.(第一次请先点击网页底部rebuild)"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.JSON(200, MetaResponse(500, err.Error()))
|
c.JSON(200, MetaResponse(500, err.Error()))
|
||||||
|
@ -62,10 +62,16 @@ func BuildOne(parent string, path string, tx *gorm.DB, parentPassword string, dr
|
|||||||
if depth == 0 {
|
if depth == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
files, err := alidrive.GetList(parent, conf.Conf.AliDrive.MaxFilesCount, "", "", "", drive)
|
marker := "first"
|
||||||
|
for marker != "" {
|
||||||
|
if marker == "first" {
|
||||||
|
marker = ""
|
||||||
|
}
|
||||||
|
files, err := alidrive.GetList(parent, conf.Conf.AliDrive.MaxFilesCount, marker, "", "", drive)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
marker = files.NextMarker
|
||||||
for _, file := range files.Items {
|
for _, file := range files.Items {
|
||||||
name := file.Name
|
name := file.Name
|
||||||
if strings.HasSuffix(name, ".hide") {
|
if strings.HasSuffix(name, ".hide") {
|
||||||
@ -100,6 +106,7 @@ func BuildOne(parent string, path string, tx *gorm.DB, parentPassword string, dr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user