mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-21 12:34:22 +08:00
Improve Decrypt errors
This commit is contained in:
parent
e0219c020a
commit
02e6198f17
1 changed files with 8 additions and 6 deletions
|
@ -64,18 +64,20 @@ abstract class Crypt
|
|||
) /* : mixed */
|
||||
{
|
||||
if (3 === \count($data) && isset($data[0], $data[1], $data[2]) && \strlen($data[0])) {
|
||||
try {
|
||||
$fn = "{$data[0]}Decrypt";
|
||||
if (\method_exists(__CLASS__, $fn)) {
|
||||
$fn = "{$data[0]}Decrypt";
|
||||
if (\method_exists(__CLASS__, $fn)) {
|
||||
Log::warning('Crypt', "{$fn} does not exists");
|
||||
} else {
|
||||
try {
|
||||
$result = static::{$fn}($data[2], $data[1], $key);
|
||||
if (\is_string($result)) {
|
||||
return static::jsonDecode($result);
|
||||
}
|
||||
throw new \Exception('invalid $data or $key');
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Crypt', "{$fn}(): {$e->getMessage()}");
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Crypt', "{$fn}(): {$e->getMessage()}");
|
||||
}
|
||||
Log::warning('Crypt', 'Decrypt() invalid $data or $key');
|
||||
} else {
|
||||
Log::warning('Crypt', 'Decrypt() invalid $data');
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue