Not removing files not in TMPDIR

This commit is contained in:
boyska 2016-12-11 01:13:33 +01:00
parent d525fbf20a
commit a49f240eb6
No known key found for this signature in database
GPG key ID: 7395DCAE58289CA9

View file

@ -29,6 +29,10 @@ class UnusedCleaner:
if not uri.startswith('file:///'):
return # not a file URI
fpath = uri[len('file://'):]
if 'TMPDIR' in os.environ and os.environ['TMPDIR'] \
and not fpath.startswith(self.conf['TMPDIR']):
self.log.info('Not watching file {}: not in TMPDIR'.format(fpath))
return
if not os.path.exists(fpath):
self.log.warning('a path that does not exist is being monitored')
self.waiting_removal_files.add(fpath)