2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Avoid crashing out if someone does too many '..'.

If user tried to change to more parent directories than existed,
confetty would rudely shutdown.  Truncate such a case to '/' rather
than bail.
This commit is contained in:
Jarrod Johnson 2014-02-22 22:15:41 -05:00
parent 2578fd5817
commit 9292d89751

View File

@ -298,7 +298,7 @@ def fullpath_target(path, forcepath=False):
del targparts[-1]
else:
targparts.append(component)
if forcepath and targparts[-1] != "":
if forcepath and len(targparts) == 0 or targparts[-1] != "":
targparts.append('')
ntarget = '/'.join(targparts)
if forcepath and (len(ntarget) == 0 or ntarget[-1] != '/'):