1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Catch errors when listing images

Fix #764
This commit is contained in:
Julien Duponchelle 2016-11-11 11:24:41 +01:00
parent 477091207d
commit 65090c6f87
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -483,11 +483,14 @@ class BaseManager:
for filename in files:
if filename[0] != "." and not filename.endswith(".md5sum"):
path = os.path.relpath(os.path.join(root, filename), img_dir)
images.append({
"filename": filename,
"path": path,
"md5sum": md5sum(os.path.join(root, filename)),
"filesize": os.stat(os.path.join(root, filename)).st_size})
try:
images.append({
"filename": filename,
"path": path,
"md5sum": md5sum(os.path.join(root, filename)),
"filesize": os.stat(os.path.join(root, filename)).st_size})
except OSError as e:
log.warn("Can't add image {}: {}".format(path, str(e)))
return images
def get_images_directory(self):