11package handles
22
33import (
4- "github.com/alist-org/alist/v3/internal/task"
5- "github.com/alist-org/alist/v3/pkg/utils"
64 "io"
75 "net/url"
86 stdpath "path"
97 "strconv"
108 "time"
119
10+ "github.com/alist-org/alist/v3/internal/task"
11+ "github.com/alist-org/alist/v3/pkg/utils"
12+
1213 "github.com/alist-org/alist/v3/internal/fs"
1314 "github.com/alist-org/alist/v3/internal/model"
1415 "github.com/alist-org/alist/v3/internal/stream"
@@ -44,7 +45,7 @@ func FsStream(c *gin.Context) {
4445 }
4546 if ! overwrite {
4647 if res , _ := fs .Get (c , path , & fs.GetArgs {NoLog : true }); res != nil {
47- _ , _ = io . Copy (io .Discard , c .Request .Body )
48+ _ , _ = utils . CopyWithBuffer (io .Discard , c .Request .Body )
4849 common .ErrorStrResp (c , "file exists" , 403 )
4950 return
5051 }
@@ -89,6 +90,9 @@ func FsStream(c *gin.Context) {
8990 return
9091 }
9192 if t == nil {
93+ if n , _ := c .Request .Body .Read ([]byte {0 }); n == 1 {
94+ _ , _ = utils .CopyWithBuffer (io .Discard , c .Request .Body )
95+ }
9296 common .SuccessResp (c )
9397 return
9498 }
@@ -114,7 +118,7 @@ func FsForm(c *gin.Context) {
114118 }
115119 if ! overwrite {
116120 if res , _ := fs .Get (c , path , & fs.GetArgs {NoLog : true }); res != nil {
117- _ , _ = io . Copy (io .Discard , c .Request .Body )
121+ _ , _ = utils . CopyWithBuffer (io .Discard , c .Request .Body )
118122 common .ErrorStrResp (c , "file exists" , 403 )
119123 return
120124 }
0 commit comments