file: Ignore dotfiles before symlinks

This reduces the amount of debug logging a lot when browsing a typical
Unix home directory.
This commit is contained in:
Stein Magnus Jodal 2015-07-09 13:22:10 +02:00
parent 61ee92e221
commit 9035d85a0e

View File

@ -59,6 +59,9 @@ class FileLibraryProvider(backend.LibraryProvider):
uri = path.path_to_uri(child_path)
printable_path = child_path.decode(FS_ENCODING, 'replace')
if not self._show_dotfiles and dir_entry.startswith(b'.'):
continue
if os.path.islink(child_path) and not self._follow_symlinks:
logger.debug('Ignoring symlink: %s', printable_path)
continue
@ -68,9 +71,6 @@ class FileLibraryProvider(backend.LibraryProvider):
printable_path)
continue
if not self._show_dotfiles and dir_entry.startswith(b'.'):
continue
name = dir_entry.decode(FS_ENCODING, 'replace')
if os.path.isdir(child_path):
result.append(models.Ref.directory(name=name, uri=uri))