Repository: AlistGo/alist (language: go)

Issue:
魔盘上传文件失败，错误码411
### Please make sure of the following things

- [X] I have read the [documentation](https://alist.nn.ci).
我已经阅读了[文档](https://alist.nn.ci)。

- [X] I'm sure there are no duplicate issues or discussions.
我确定没有重复的issue或讨论。

- [X] I'm sure it's due to `AList` and not something else(such as [Network](https://alist.nn.ci/faq/howto.html#tls-handshake-timeout-read-connection-reset-by-peer-dns-lookup-failed-connect-connection-refused-client-timeout-exceeded-while-awaiting-headers-no-such-host) ,`Dependencies` or `Operational`).
我确定是`AList`的问题，而不是其他原因（例如[网络](https://alist.nn.ci/zh/faq/howto.html#tls-handshake-timeout-read-connection-reset-by-peer-dns-lookup-failed-connect-connection-refused-client-timeout-exceeded-while-awaiting-headers-no-such-host)，`依赖`或`操作`）。

- [X] I'm sure this issue is not fixed in the latest version.
我确定这个问题在最新版本中没有被修复。


### AList Version / AList 版本

v3.32.0

### Driver used / 使用的存储驱动

魔盘

### Describe the bug / 问题描述

上传文件时报错，“All attempts fail: #1: upload err,code=411 #2: upload err,code=411 #3: upload err,code=411”

### Reproduction / 复现链接

/api/fs/put

### Config / 配置

config.json:
```
{
  "force": false,
  "site_url": "",
  "cdn": "",
  "jwt_secret": "******",
  "token_expires_in": 48,
  "database": {
    "type": "sqlite3",
    "host": "",
    "port": 0,
    "user": "",
    "password": "",
    "name": "",
    "db_file": "data/data.db",
    "table_prefix": "x_",
    "ssl_mode": "",
    "dsn": ""
  },
  "meilisearch": {
    "host": "http://localhost:7700",
    "api_key": "",
    "index_prefix": ""
  },
  "scheme": {
    "address": "0.0.0.0",
    "http_port": 5244,
    "https_port": -1,
    "force_https": false,
    "cert_file": "",
    "key_file": "",
    "unix_file": "",
    "unix_file_perm": ""
  },
  "temp_dir": "data/temp",
  "bleve_dir": "data/bleve",
  "dist_dir": "",
  "log": {
    "enable": true,
    "name": "data/log/log.log",
    "max_size": 50,
    "max_backups": 30,
    "max_age": 28,
    "compress": false
  },
  "delayed_start": 0,
  "max_connections": 0,
  "tls_insecure_skip_verify": true,
  "tasks": {
    "download": {
      "workers": 5,
      "max_retry": 1
    },
    "transfer": {
      "workers": 5,
      "max_retry": 2
    },
    "upload": {
      "workers": 5,
      "max_retry": 0
    },
    "copy": {
      "workers": 5,
      "max_retry": 2
    }
  },
  "cors": {
    "allow_origins": [
      "*"
    ],
    "allow_methods": [
      "*"
    ],
    "allow_headers": [
      "*"
    ]
  }
}
```
存储配置：
![image](https://github.com/alist-org/alist/assets/22746567/e5b305e2-51d7-4f86-b422-d77e1b5ff00d)


### Logs / 日志

```
[31mERRO[0m[2024-03-07 08:31:21] failed to close file streamer, close /data/data/com.termux/files/home/shells/data/temp/file-******: file already closed 
[31mERRO[0m[2024-03-07 08:31:21] failed put /mopan/test/: All attempts fail:
#1: upload err,code=411
#2: upload err,code=411
#3: upload err,code=411
github.com/alist-org/alist/v3/internal/op.Put
	/home/builder/.termux-build/alist/src/internal/op/fs.go:580
github.com/alist-org/alist/v3/internal/fs.putDirectly
	/home/builder/.termux-build/alist/src/internal/fs/put.go:70
github.com/alist-org/alist/v3/internal/fs.PutDirectly
	/home/builder/.termux-build/alist/src/internal/fs/fs.go:97
github.com/alist-org/alist/v3/server/handles.FsStream
	/home/builder/.termux-build/alist/src/server/handles/fsup.go:65
github.com/gin-gonic/gin.(*Context).Next
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/alist-org/alist/v3/server/middlewares.FsUp
	/home/builder/.termux-build/alist/src/server/middlewares/fsup.go:43
github.com/gin-gonic/gin.(*Context).Next
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/alist-org/alist/v3/server/middlewares.Auth
	/home/builder/.termux-build/alist/src/server/middlewares/auth.go:73
github.com/gin-gonic/gin.(*Context).Next
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/alist-org/alist/v3/server/middlewares.StoragesLoaded
	/home/builder/.termux-build/alist/src/server/middlewares/check.go:14
github.com/gin-gonic/gin.(*Context).Next
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102
github.com/gin-gonic/gin.(*Context).Next
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.LoggerWithConfig.func1
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240
github.com/gin-gonic/gin.(*Context).Next
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620
github.com/gin-gonic/gin.(*Engine).ServeHTTP
	/home/builder/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576
net/http.serverHandler.ServeHTTP
	/home/builder/.termux-build/_cache/go1.21.6/src/net/http/server.go:2938
net/http.(*conn).serve
	/home/builder/.termux-build/_cache/go1.21.6/src/net/http/server.go:2009
runtime.goexit
	/home/builder/.termux-build/_cache/go1.21.6/src/runtime/asm_arm64.s:1197 
```


Discussion / hints:
Thanks for opening your first issue here! Be sure to follow the issue template!


Fix patch:
diff --git a/drivers/mopan/driver.go b/drivers/mopan/driver.go
index b5441bff2ea..369ec83b64d 100644
--- a/drivers/mopan/driver.go
+++ b/drivers/mopan/driver.go
@@ -295,7 +295,7 @@ func (d *MoPan) Put(ctx context.Context, dstDir model.Obj, stream model.FileStre
 	}
 
 	if !initUpdload.FileDataExists {
-		utils.Log.Error(d.client.CloudDiskStartBusiness())
+		// utils.Log.Error(d.client.CloudDiskStartBusiness())
 
 		threadG, upCtx := errgroup.NewGroupWithContext(ctx, d.uploadThread,
 			retry.Attempts(3),
@@ -323,6 +323,7 @@ func (d *MoPan) Put(ctx context.Context, dstDir model.Obj, stream model.FileStre
 				if err != nil {
 					return err
 				}
+				req.ContentLength = byteSize
 				resp, err := base.HttpClient.Do(req)
 				if err != nil {
 					return err


Test patch: