From 9292d89751e47da96602de10d1fb96af1a9879b2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 22 Feb 2014 22:15:41 -0500 Subject: [PATCH] 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. --- bin/confetty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/confetty b/bin/confetty index 3cc8753d..10a8a918 100755 --- a/bin/confetty +++ b/bin/confetty @@ -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] != '/'):