Skip to content

Commit

Permalink
🐛 修复百度网盘删除文件失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Mar 20, 2024
1 parent 75c4522 commit e516058
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/filesystem/baidu/baidu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,16 @@ export default class BaiduFileSystem implements FileSystem {

delete(path: string): Promise<void> {
const filelist = [joinPath(this.path, path)];
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
return this.request(
`https://pan.baidu.com/rest/2.0/xpan/file?method=filemanager&access_token=${this.accessToken}&opera=delete`,
{
method: "POST",
body: `async=0&filelist=${encodeURIComponent(
JSON.stringify(filelist)
)}`,
headers: myHeaders,
}
).then((data) => {
if (data.errno) {
Expand Down

0 comments on commit e516058

Please sign in to comment.