fix when no read right on file

This commit is contained in:
azlux 2018-06-06 01:12:39 +02:00
parent bd532e5c22
commit b1611621dc
2 changed files with 19 additions and 14 deletions

View File

@ -11,6 +11,7 @@ from werkzeug.utils import secure_filename
import errno
import media
class ReverseProxied(object):
'''Wrap the application in this middleware and configure the
front-end server to add these headers, to let you quietly bind
@ -187,6 +188,7 @@ def upload():
else:
return redirect("./", code=409)
@web.route('/download', methods=["GET"])
def download():
if 'file' in request.args:

View File

@ -21,7 +21,6 @@ def get_recursive_filelist_sorted(path):
fullpath = os.path.join(path, relroot, file)
if not os.access(fullpath, os.R_OK):
print("coucou")
continue
mime = magic.from_file(fullpath, mime=True)
@ -54,8 +53,12 @@ def zipdir(zippath, zipname_prefix=None):
zipf = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
for file in files:
filepath = os.path.dirname(file)
file_to_add = os.path.join(zippath, file)
if not os.access(file_to_add, os.R_OK):
continue
if file in var.config.get('bot', 'ignored_files'):
continue
add_file_as = os.path.relpath(os.path.join(zippath, file), os.path.join(zippath, '..'))
zipf.write(file_to_add, add_file_as)