Skip to content

Commit

Permalink
修复秒传目录或文件名带"&"时不正确行为
Browse files Browse the repository at this point in the history
  • Loading branch information
hxz393 committed Jan 8, 2023
1 parent 9b69638 commit 2a8269a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ bdpan://44K344Or44Kv44Gu5p6c5a6fICsg44Go44KJ44Gu44GC44Gq44CA5o+P44GN5LiL44KN44GX


## 更新日志
**2023.01.08 更新版本 1.12.1**

修复秒传目录或文件名带"&"时不正确行为

**2023.01.03 更新版本 1.12**

1.更换秒传转存请求接口;
Expand Down
10 changes: 5 additions & 5 deletions bpftUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

'''
软件名: BaiduPanFilesTransfers
版本: 1.12
更新时间: 2023.01.03
版本: 1.12.1
更新时间: 2023.01.08
打包命令: pyinstaller -F -w -i bpftUI.ico bpftUI.py
'''

Expand All @@ -32,7 +32,7 @@
root.iconbitmap(default=ICON_PATH)

# 主窗口配置
root.wm_title("度盘转存 1.12 by assassing")
root.wm_title("度盘转存 1.12.1 by assassing")
root.wm_geometry('350x473+240+240')
root.wm_attributes("-alpha", 0.91)
# root.resizable(width=False, height=False)
Expand Down Expand Up @@ -187,10 +187,10 @@ def transfer_files_rapid(rapid_data, dir_name, bdstoken):
request_header['User-Agent'] = 'netdisk;2.2.51.6;netdisk;10.0.63;PC;android-android;QTP/1.0.32.2'
url = 'https://pan.baidu.com/rest/2.0/xpan/file?method=create&bdstoken=' + bdstoken
# post_data = {'path': dir_name + '/' + rapid_data[3], 'content-md5': rapid_data[0], 'slice-md5': rapid_data[1], 'content-length': rapid_data[2]}
post_data = "&block_list=%5B%22"+rapid_data[0]+"%22%5D&path=%2F"+dir_name+"%2F"+rapid_data[3]+"&size="+rapid_data[2]+"&isdir=0&rtype=0"
post_data = '&block_list=["{}"]&path=/{}/{}&size={}&isdir=0&rtype=0'.format(rapid_data[0], dir_name.replace("&","%26"), rapid_data[3].replace("&","%26"), rapid_data[2])
response = s.post(url=url, headers=request_header, data=post_data.encode("utf-8"), timeout=15, allow_redirects=False, verify=False)
if response.json()['errno'] == 404:
post_data = "&block_list=%5B%22" + rapid_data[0].lower() + "%22%5D&path=%2F" + dir_name + "%2F" + rapid_data[3] + "&size=" + rapid_data[2] + "&isdir=0&rtype=0"
post_data = '&block_list=["{}"]&path=/{}/{}&size={}&isdir=0&rtype=0'.format(rapid_data[0].lower(), dir_name.replace("&", "%26"), rapid_data[3].replace("&", "%26"), rapid_data[2])
response = s.post(url=url, headers=request_header, data=post_data, timeout=15, allow_redirects=False, verify=False)
elif response.json()['errno'] == 2:
time.sleep(1)
Expand Down

0 comments on commit 2a8269a

Please sign in to comment.