diff --git a/lib/tfw/components/webide_event_handler.py b/lib/tfw/components/webide_event_handler.py index d3992b4..30c3e98 100644 --- a/lib/tfw/components/webide_event_handler.py +++ b/lib/tfw/components/webide_event_handler.py @@ -65,9 +65,7 @@ class FileManager: # pylint: disable=too-many-instance-attributes @property def files(self): return [self._relpath(file) for file in glob(join(self._workdir, '**/*'), recursive=True) - if isfile(file) - and self._is_whitelisted(file) - and not any(fnmatchcase(file, blacklisted) for blacklisted in self.exclude)] + if isfile(file) and self._is_whitelisted(file) and not self._is_blacklisted(file)] @property def file_contents(self): @@ -82,6 +80,9 @@ class FileManager: # pylint: disable=too-many-instance-attributes def _is_whitelisted(self, file): return any(realpath(file).startswith(allowed_dir) for allowed_dir in self.allowed_directories) + def _is_blacklisted(self, file): + return any(fnmatchcase(file, blacklisted) for blacklisted in self.exclude) + def _filepath(self, filename): return join(self._workdir, filename)