Skip to content

Commit

Permalink
when mkdir of missing app folders, handle broken links properly
Browse files Browse the repository at this point in the history
  • Loading branch information
smorrison committed Dec 1, 2016
1 parent 0b8ecea commit 52fe440
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gluon/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,11 @@ def add_path_first(path):
def try_mkdir(path):
if not os.path.exists(path):
try:
os.mkdir(path)
if os.path.islink(path):
# path is a broken link, try to mkdir the target of the link instead of the link itself.
os.mkdir(os.path.realpath(path))
else:
os.mkdir(path)
except OSError as e:
if e.strerror == 'File exists': # In case of race condition.
pass
Expand Down

0 comments on commit 52fe440

Please sign in to comment.