mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Fix: storage policy should be re-dispatched according to policy id in upload session
This commit is contained in:
@@ -2,6 +2,7 @@ package callback
|
||||
|
||||
import (
|
||||
"context"
|
||||
model "github.com/HFO4/cloudreve/models"
|
||||
"github.com/HFO4/cloudreve/pkg/filesystem"
|
||||
"github.com/HFO4/cloudreve/pkg/filesystem/fsctx"
|
||||
"github.com/HFO4/cloudreve/pkg/filesystem/local"
|
||||
@@ -61,6 +62,17 @@ func ProcessCallback(service CallbackProcessService, c *gin.Context) serializer.
|
||||
}
|
||||
callbackSession := callbackSessionRaw.(*serializer.UploadSession)
|
||||
|
||||
// 重新指向上传策略
|
||||
policy, err := model.GetPolicyByID(callbackSession.PolicyID)
|
||||
if err != nil {
|
||||
return serializer.Err(serializer.CodePolicyNotAllowed, err.Error(), err)
|
||||
}
|
||||
fs.Policy = &policy
|
||||
err = fs.DispatchHandler()
|
||||
if err != nil {
|
||||
return serializer.Err(serializer.CodePolicyNotAllowed, err.Error(), err)
|
||||
}
|
||||
|
||||
// 获取父目录
|
||||
exist, parentFolder := fs.IsPathExist(callbackSession.VirtualPath)
|
||||
if !exist {
|
||||
|
||||
Reference in New Issue
Block a user