Merge pull request #302 from gedakc/issue-281-hidden-file-crash-open-project

Skip loading directory and file names that begin with a period
This commit is contained in:
Olivier 2018-01-18 10:18:58 +01:00 committed by GitHub
commit 30a49a44d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -647,7 +647,13 @@ def loadProject(project, zip=None):
files = {}
for dirpath, dirnames, filenames in os.walk(path):
p = dirpath.replace(path, "")
# Skip directories that begin with a period
if p[:1] == ".":
continue
for f in filenames:
# Skip filenames that begin with a period
if f[:1] == ".":
continue
# mode = "r" + ("b" if f[-4:] in [".xml", "opml"] else "")
if f[-4:] in [".xml", "opml"]:
with open(os.path.join(dirpath, f), "rb") as fo: