APFS volumes don't necessarily have names (#490)

This commit is contained in:
Ana Hobden 2023-05-31 13:36:24 -07:00 committed by GitHub
parent d47968d982
commit f91b93bdb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -32,7 +32,7 @@ impl CreateApfsVolume {
plist::from_bytes(&output.stdout).map_err(Self::error)?;
for container in parsed.containers {
for volume in container.volumes {
if volume.name == name {
if volume.name.as_ref() == Some(&name) {
return Ok(StatefulAction::completed(Self {
disk: disk.as_ref().to_path_buf(),
name,

View file

@ -83,7 +83,7 @@ impl EncryptApfsVolume {
plist::from_bytes(&output.stdout).map_err(Self::error)?;
for container in parsed.containers {
for volume in container.volumes {
if volume.name == name {
if volume.name.as_ref() == Some(&name) {
match volume.encryption == false {
true => {
return Ok(StatefulAction::completed(Self { disk, name }));

View file

@ -23,6 +23,6 @@ pub struct DiskUtilApfsContainer {
#[derive(serde::Deserialize, Clone, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct DiskUtilApfsListVolume {
pub name: String,
pub name: Option<String>,
pub encryption: bool,
}