From 6b3346d90cc32400009008fe32184bb384ed172c Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 16 May 2024 15:28:25 +0100 Subject: [PATCH] Only attempt to decrypt if there is a value Signed-off-by: snipe --- .../Transformers/ActionlogsTransformer.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app/Http/Transformers/ActionlogsTransformer.php b/app/Http/Transformers/ActionlogsTransformer.php index d99e570810..ca0f6296ee 100644 --- a/app/Http/Transformers/ActionlogsTransformer.php +++ b/app/Http/Transformers/ActionlogsTransformer.php @@ -85,20 +85,23 @@ class ActionlogsTransformer $enc_old = ''; $enc_new = ''; - try { - $enc_old = \Crypt::decryptString($this->clean_field($fieldata->old)); - } catch (\Exception $e) { - \Log::debug('Could not decrypt field - maybe the key changed?'); + if ($this->clean_field($fieldata->old!='')) { + try { + $enc_old = \Crypt::decryptString($this->clean_field($fieldata->old)); + } catch (\Exception $e) { + \Log::debug('Could not decrypt old field value - maybe the key changed?'); + } } - try { - $enc_new = \Crypt::decryptString($this->clean_field($fieldata->new)); - } catch (\Exception $e) { - \Log::debug('Could not decrypt field - maybe the key changed?'); + if ($this->clean_field($fieldata->new!='')) { + try { + $enc_new = \Crypt::decryptString($this->clean_field($fieldata->new)); + } catch (\Exception $e) { + \Log::debug('Could not decrypt new field value - maybe the key changed?'); + } } if ($enc_old != $enc_new) { - \Log::debug('custom fields do not match'); $clean_meta[$fieldname]['old'] = "************"; $clean_meta[$fieldname]['new'] = "************";