Some symlinks end up pointing to nonexistent names, which is maybe not
"normal", but certainly is allowed.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
# link should be based on fully resolved type to avoid extra
# HTTP redirect.
# link should be based on fully resolved type to avoid extra
# HTTP redirect.
- if stat.S_ISDIR(sub.lresolve('').mode):
+ if stat.S_ISDIR(sub.try_lresolve('').mode):
link = sub.name + "/"
size = None
link = sub.name + "/"
size = None
#log('parts: %r %r\n' % (path, parts))
return start._lresolve(parts)
#log('parts: %r %r\n' % (path, parts))
return start._lresolve(parts)
+ def try_lresolve(self, path):
+ try:
+ return self.lresolve(path)
+ except NoSuchFile:
+ # some symlinks don't actually point at a file that exists!
+ return self
+
def resolve(self, path):
return self.lresolve(path).lresolve('')
def resolve(self, path):
return self.lresolve(path).lresolve('')