Merge pull request #546 from dylanmtaylor/patch-1

Attempt to avoid crashing when encountering swap partitions in has_content
This commit is contained in:
Anton Hvornum 2021-06-03 14:27:39 +02:00 committed by GitHub
commit a4033a7d3a
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()