Skip to content

Commit 020a237

Browse files
committed
ignore not readable file on uploading a folder
1 parent d5cb1b9 commit 020a237

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#backup file
2+
*.*~
3+
14
*.py[cod]
25

36
# C extensions

bypy.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,10 @@ def __walk_upload(self, arg, dirname, names):
15571557

15581558
result = ENoError
15591559
for name in names:
1560-
lfile = os.path.join(dirname, name)
1560+
lfile = os.path.join(dirname, name)
1561+
if not os.access(lfile,os.R_OK):
1562+
self.pv('ignoring {} due to permission problem'.format(lfile))
1563+
continue
15611564
if os.path.isfile(lfile):
15621565
self.__current_file = lfile
15631566
self.__current_file_size = getfilesize(lfile)
@@ -2177,6 +2180,9 @@ def __proceed_local_gather(self, arg, dirname, names):
21772180
dirs = []
21782181
for name in names:
21792182
fullname = os.path.join(dirname, name)
2183+
if not os.access(fullname,os.R_OK):
2184+
self.pv('Ignoring file {} due to permission problem'.format(fullname));
2185+
continue
21802186
if os.path.isfile(fullname):
21812187
files.append((name, getfilesize(fullname), md5(fullname)))
21822188
elif os.path.isdir(fullname):

0 commit comments

Comments
 (0)