提交 e7bd1a0b 编写于 作者: H Hou Tianze

Properly handle error_code 31061 (treat as no error)

上级 950d891b
### Version History:
- 1.6.2: Properly handle (treat it as no error) error_code 31061 (file already exists) from PCS
- 1.6.1: Ensure cache loading/saving failures won't affect normal operations; Fix the bug that clean up code not called on exit
- 1.6.0: Fix 1000 items limit for remote directory listing
- 1.5.13: Fix multiprocess upload/syncup missing some files
......
Version History:
~~~~~~~~~~~~~~~~
- 1.6.2: Properly handle (treat it as no error) error\_code 31061 (file
already exists) from PCS
- 1.6.1: Ensure cache loading/saving failures won't affect normal
operations; Fix the bug that clean up code not called on exit
- 1.6.0: Fix 1000 items limit for remote directory listing
......
......@@ -717,9 +717,20 @@ class ByPy(object):
or ec == const.IEBlockMissInSuperFile2:
self.pd("Failed to combine files from MD5 slices")
result = ec
elif ec == const.IEFileAlreadyExists: # ec == 31061, sc == 400, file already exists
# explanations:
# this error occurs when we try to create a directory at Baidu PCS when it already exists,
# this almost only happens when we upload using multi-process (double/multiple-directory creation).
# this error is innocuous, we can safely ignore it
# (actually, we don't need to do anything further and should just continue as usual).
# so to avoid confusions to the user and potential logic errors (more importantly) in the future,
# we just "lie" and force it to "no error".
# though this is not 100% accurate technically, i feel it's accurate enough for the users
self.pd("Faking error_code {} to {}, this is safe to ignore.".format(
const.IEFileAlreadyExists, const.ENoError))
result = const.ENoError
# errors that make retrying meaningless
elif (
#ec == 31061 or # sc == 400 file already exists
ec == 31062 or # sc == 400 file name is invalid
ec == 31063 or # sc == 400 file parent path does not exist
ec == 31064 or # sc == 403 file is not authorized
......
......@@ -12,7 +12,7 @@ import os
# https://packaging.python.org/single_source_version/
__title__ = 'bypy'
__version__ = '1.6.1'
__version__ = '1.6.2'
__author__ = 'Hou Tianze'
__license__ = 'MIT'
__desc__ = 'Python client for Baidu Yun (Personal Cloud Storage) 百度云/百度网盘 Python 客户端'
......
{
"comment": "Update info",
"recommendedVersion": "1.6.1",
"minimumRequiredVersion": "1.6.1"
"recommendedVersion": "1.6.2",
"minimumRequiredVersion": "1.6.0"
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册