mirror of
https://github.com/cloudreve/Cloudreve.git
synced 2026-11-17 22:58:07 +00:00
Feat: adapt major methods of WebDAV for Cloudreve file system
This commit is contained in:
1 parent
1dac66e632
commit
9fdf2fe7ab
10 files changed
+327
-258
No files matched your search
@@ -78,9 +78,15 @@ func (fs *FileSystem) GenerateSavePath(ctx context.Context, file FileHeader) str
|
||||
|
||||
// CancelUpload 监测客户端取消上传
|
||||
func (fs *FileSystem) CancelUpload(ctx context.Context, path string, file FileHeader) {
|
||||
ginCtx := ctx.Value(fsctx.GinCtx).(*gin.Context)
|
||||
var reqContext context.Context
|
||||
if ginCtx, ok := ctx.Value(fsctx.GinCtx).(*gin.Context); ok {
|
||||
reqContext = ginCtx.Request.Context()
|
||||
} else {
|
||||
reqContext = ctx.Value(fsctx.HTTPCtx).(context.Context)
|
||||
}
|
||||
|
||||
select {
|
||||
case <-ginCtx.Request.Context().Done():
|
||||
case <-reqContext.Done():
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
// 客户端正常关闭,不执行操作
|
||||
|
||||
Reference in new issue
Block a user