Skip to content

Commit

Permalink
Fixes storage link new file regression
Browse files Browse the repository at this point in the history
Signed-off-by: Javier Martin Montull <javier.martin.montull@cern.ch>
  • Loading branch information
jmartinm committed Oct 8, 2014
1 parent 59709b2 commit 5c183ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flask_collect/storage/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ def run(self):
for bp, f, o in self:
destination = os.path.join(self.collect.static_root, o)
destination_dir = os.path.dirname(destination)
normalized_source = os.path.realpath(f)
if not os.path.exists(destination_dir):
os.makedirs(destination_dir)

if destination in destination_list:
self.log("{0} already linked".format(destination))
skipped += 1
elif not os.path.exists(destination):
elif not os.path.exists(destination) or \
normalized_source != os.path.realpath(destination):
# the path is a link, but points to invalid location
if os.path.islink(destination):
os.remove(destination)
Expand Down

0 comments on commit 5c183ae

Please sign in to comment.