Attempt to avoid crashing when encountering swap partitions in has_content()

This commit is contained in:
Dylan M. Taylor 2021-06-03 08:25:36 -04:00 committed by GitHub
parent 7b4564c0fc
commit f1503349da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -254,7 +254,8 @@ class Partition:
return None
def has_content(self):
if not get_filesystem_type(self.path):
fs_type = get_filesystem_type(self.path)
if not fs_type or "swap" in fs_type:
return False
temporary_mountpoint = '/tmp/' + hashlib.md5(bytes(f"{time.time()}", 'UTF-8') + os.urandom(12)).hexdigest()