Skip to content

Commit

Permalink
rtype=3
Browse files Browse the repository at this point in the history
  • Loading branch information
qjfoidnh committed Sep 12, 2023
1 parent 8c035ae commit 0c7c515
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions baidupcs/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package baidupcs

import (
"bytes"
"fmt"
"io"
"net/http"
"net/url"
Expand Down Expand Up @@ -312,7 +311,13 @@ func (pcs *BaiduPCS) prepareRapidUpload(targetPath, contentMD5, sliceMD5, crc32
"bdstoken": bdstoken,
})
baiduPCSVerbose.Infof("%s URL: %s\n", OperationRapidUpload, pcsURL)
post := fmt.Sprintf("&block_list=[\"%s\"]&path=%s&size=%d&isdir=0&rtype=0", contentMD5, targetPath, length)
post := map[string]string{
"block_list": mergeStringList(contentMD5),
"path": targetPath,
"size": strconv.FormatInt(length, 10),
"isdir": "0",
"rtype": "3",
}
baiduPCSVerbose.Infof("%s URL: %s, Post: %v\n", OperationRapidUpload, pcsURL, post)

dataReadCloser, pcsError = pcs.sendReqReturnReadCloser(reqTypePan, OperationRapidUpload, http.MethodPost, pcsURL.String(), post, nil)
Expand Down
1 change: 1 addition & 0 deletions internal/pcsconfig/baidu.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Baidu struct {
BDUSS string `json:"bduss"`
PTOKEN string `json:"ptoken"`
STOKEN string `json:"stoken"`
BAIDUID string `json:"baiduid"`
SBOXTKN string `json:"sboxtkn"`
COOKIES string `json:"cookies"`

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func main() {
注意accessToken的有效期为一个月, 过期后请重复上述步骤更新token
示例:
BaiduPCS-Go accessToken 156.182v9052tgf1006c89891bsfb2401974.YmKOAwBD9yGaG2s4p5NNkX4CXeIbJxx4hAxotfS.PyuHEs
BaiduPCS-Go setastoken 156.182v9052tgf1006c89891bsfb2401974.YmKOAwBD9yGaG2s4p5NNkX4CXeIbJxx4hAxotfS.PyuHEs
`,
Category: "百度帐号",
Before: reloadFn,
Expand Down

0 comments on commit 0c7c515

Please sign in to comment.