mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 02:32:58 -03:00
Remove cleanup_tempfiles altogether because they are not being used
This commit is contained in:
parent
33fd639f2a
commit
305abff13c
3 changed files with 0 additions and 13 deletions
|
@ -201,9 +201,6 @@ class SendBaseModeWeb:
|
||||||
self._gzip_compress(filesystem_path, gzip_filename, 6, None)
|
self._gzip_compress(filesystem_path, gzip_filename, 6, None)
|
||||||
self.gzip_individual_files[filesystem_path] = gzip_filename
|
self.gzip_individual_files[filesystem_path] = gzip_filename
|
||||||
|
|
||||||
# Cleanup this temp file
|
|
||||||
self.web.cleanup_tempfiles.append(gzip_filename)
|
|
||||||
|
|
||||||
file_to_download = self.gzip_individual_files[filesystem_path]
|
file_to_download = self.gzip_individual_files[filesystem_path]
|
||||||
filesize = os.path.getsize(self.gzip_individual_files[filesystem_path])
|
filesize = os.path.getsize(self.gzip_individual_files[filesystem_path])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -171,7 +171,6 @@ class Web:
|
||||||
self.socketio.init_app(self.app)
|
self.socketio.init_app(self.app)
|
||||||
self.chat_mode = ChatModeWeb(self.common, self)
|
self.chat_mode = ChatModeWeb(self.common, self)
|
||||||
|
|
||||||
self.cleanup_tempfiles = []
|
|
||||||
self.cleanup_tempdirs = []
|
self.cleanup_tempdirs = []
|
||||||
|
|
||||||
def get_mode(self):
|
def get_mode(self):
|
||||||
|
@ -405,13 +404,8 @@ class Web:
|
||||||
"""
|
"""
|
||||||
self.common.log("Web", "cleanup")
|
self.common.log("Web", "cleanup")
|
||||||
|
|
||||||
# Close all of the tempfile.NamedTemporaryFile
|
|
||||||
for file in self.cleanup_tempfiles:
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
# Clean up the tempfile.NamedTemporaryDirectory objects
|
# Clean up the tempfile.NamedTemporaryDirectory objects
|
||||||
for dir in self.cleanup_tempdirs:
|
for dir in self.cleanup_tempdirs:
|
||||||
dir.cleanup()
|
dir.cleanup()
|
||||||
|
|
||||||
self.cleanup_tempfiles = []
|
|
||||||
self.cleanup_tempdirs = []
|
self.cleanup_tempdirs = []
|
||||||
|
|
|
@ -308,17 +308,13 @@ class TestWeb:
|
||||||
def test_cleanup(self, common_obj, temp_dir_1024):
|
def test_cleanup(self, common_obj, temp_dir_1024):
|
||||||
web = web_obj(temp_dir_1024, common_obj, "share", 3)
|
web = web_obj(temp_dir_1024, common_obj, "share", 3)
|
||||||
|
|
||||||
temp_file = tempfile.NamedTemporaryFile()
|
|
||||||
temp_dir = tempfile.TemporaryDirectory()
|
temp_dir = tempfile.TemporaryDirectory()
|
||||||
|
|
||||||
web.cleanup_tempfiles = [temp_file]
|
|
||||||
web.cleanup_tempdirs = [temp_dir]
|
web.cleanup_tempdirs = [temp_dir]
|
||||||
web.cleanup()
|
web.cleanup()
|
||||||
|
|
||||||
assert os.path.exists(temp_file.name) is False
|
|
||||||
assert os.path.exists(temp_dir.name) is False
|
assert os.path.exists(temp_dir.name) is False
|
||||||
|
|
||||||
assert web.cleanup_tempfiles == []
|
|
||||||
assert web.cleanup_tempdirs == []
|
assert web.cleanup_tempdirs == []
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue