Skip to content

Commit

Permalink
fix: return raw data if decrypt failed
Browse files Browse the repository at this point in the history
  • Loading branch information
RCmerci committed Dec 10, 2024
1 parent 53eb2cf commit 3ca347c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions rsapi-impl/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,14 @@ impl Graph {
if data.starts_with(b"-----BEGIN AGE ENCRYPTED FILE-----")
|| data.starts_with(b"age-encryption.org/v1\n")
{
let decrypted = lsq_encryption::decrypt_with_x25519(&self.age_secret_key, data)?;
return Ok(decrypted.to_vec().into());
if let Ok(decrypted) = lsq_encryption::decrypt_with_x25519(&self.age_secret_key, data) {
Ok(decrypted.to_vec().into())
} else {
Ok(data.into())
}
} else {
Ok(data.into())
}

Ok(data.into())
}

pub async fn get_files_meta<P0: AsRef<Path>, P1: AsRef<str>, PS>(
Expand Down

0 comments on commit 3ca347c

Please sign in to comment.