From 9a4da9d7f0dc1daaea5e63ee82528a5d0e728050 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 28 Mar 2023 10:02:22 +0200 Subject: [PATCH] Use Actions()->decodeRawKey() --- snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php | 2 +- .../v/0.0.0/app/libraries/RainLoop/Actions/Messages.php | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php index fa02acefd..f32588d9b 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -1087,7 +1087,7 @@ class Actions return \MailSo\Base\Utils::UrlSafeBase64Encode(\json_encode($aValues)); } - protected function decodeRawKey(string $sRawKey): array + public function decodeRawKey(string $sRawKey): array { return empty($sRawKey) ? [] : (\json_decode(\MailSo\Base\Utils::UrlSafeBase64Decode($sRawKey), true) ?: []); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php index 324565321..4adb7298d 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php @@ -23,8 +23,7 @@ trait Messages // throw new ClientException(Notifications::CantGetMessageList); $oParams = new \MailSo\Mail\MessageListParams; - $sRawKey = $this->GetActionParam('RawKey', ''); - $aValues = $sRawKey ? \json_decode(\MailSo\Base\Utils::UrlSafeBase64Decode($sRawKey), true) : null; + $aValues = $this->decodeRawKey($this->GetActionParam('RawKey', '')); $sHash = ''; if ($aValues && 6 < \count($aValues)) { // GET @@ -404,9 +403,7 @@ trait Messages */ public function DoMessage() : array { - $sRawKey = (string) $this->GetActionParam('RawKey', ''); - - $aValues = \json_decode(\MailSo\Base\Utils::UrlSafeBase64Decode($sRawKey), true); + $aValues = $this->decodeRawKey((string) $this->GetActionParam('RawKey', '')); if ($aValues && 2 <= \count($aValues)) { $sFolder = (string) $aValues[0]; $iUid = (int) $aValues[1];