mirror of https://github.com/cloudreve/Cloudreve
fix(import): import from slave not working / fix(recycle): skip sending delete request if no blob needs to be deleted in this batch
parent
2fac086127
commit
7bace40a4d
|
@ -190,8 +190,7 @@ func SlaveFileListRoute(srcPath string, recursive bool) string {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("recursive", strconv.FormatBool(recursive))
|
query.Set("recursive", strconv.FormatBool(recursive))
|
||||||
query.Set("path", srcPath)
|
query.Set("path", srcPath)
|
||||||
route, _ := url.Parse(constants.APIPrefixSlave + fmt.Sprintf("%s?%s", base, query.Encode()))
|
return fmt.Sprintf("%s?%s", base, query.Encode())
|
||||||
return route.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func SlaveThumbUrl(base *url.URL, srcPath, ext string) *url.URL {
|
func SlaveThumbUrl(base *url.URL, srcPath, ext string) *url.URL {
|
||||||
|
|
|
@ -245,7 +245,7 @@ func (c *remoteClient) List(ctx context.Context, path string, recursive bool) ([
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.Code != 0 {
|
if resp.Code != 0 {
|
||||||
return nil, fmt.Errorf(resp.Error)
|
return nil, serializer.NewErrorFromResponse(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
var objects []fs.PhysicalObject
|
var objects []fs.PhysicalObject
|
||||||
|
|
|
@ -225,10 +225,12 @@ func (m *manager) RecycleEntities(ctx context.Context, force bool, entityIDs ...
|
||||||
}), func(entity fs.Entity, index int) string {
|
}), func(entity fs.Entity, index int) string {
|
||||||
return entity.Source()
|
return entity.Source()
|
||||||
})
|
})
|
||||||
res, err := d.Delete(ctx, toBeDeletedSrc...)
|
if len(toBeDeletedSrc) > 0 {
|
||||||
if err != nil {
|
res, err := d.Delete(ctx, toBeDeletedSrc...)
|
||||||
for _, src := range res {
|
if err != nil {
|
||||||
ae.Add(strconv.Itoa(mapSrcToId[src]), err)
|
for _, src := range res {
|
||||||
|
ae.Add(strconv.Itoa(mapSrcToId[src]), err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,9 +129,6 @@ func initSlaveRouter(dep dependency.Dep) *gin.Engine {
|
||||||
// v4.POST("ping/aria2", controllers.AdminTestAria2)
|
// v4.POST("ping/aria2", controllers.AdminTestAria2)
|
||||||
initSlaveFileRouter(v4)
|
initSlaveFileRouter(v4)
|
||||||
|
|
||||||
// 列出文件
|
|
||||||
v4.POST("list", controllers.SlaveList)
|
|
||||||
|
|
||||||
// 离线下载
|
// 离线下载
|
||||||
download := v4.Group("download")
|
download := v4.Group("download")
|
||||||
{
|
{
|
||||||
|
|
|
@ -248,8 +248,8 @@ func (service *SlaveDeleteFileService) Delete(c *gin.Context) ([]string, error)
|
||||||
type (
|
type (
|
||||||
SlaveListParamCtx struct{}
|
SlaveListParamCtx struct{}
|
||||||
SlaveListService struct {
|
SlaveListService struct {
|
||||||
Path string `uri:"path" binding:"required"`
|
Path string `form:"path" binding:"required"`
|
||||||
Recursive bool `uri:"recursive"`
|
Recursive bool `form:"recursive"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue