Skip to content

Commit

Permalink
Updated postalrequest to decode base64 message
Browse files Browse the repository at this point in the history
  • Loading branch information
siebsie23 authored May 19, 2023
1 parent 276fcd5 commit c9d12c2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Http/Requests/PostalRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class PostalRequest extends FormRequest
public function validator()
{
return Validator::make($this->all(), [
'email' => 'required',
'message' => 'required',
'base64' => 'required',
]);
}

Expand All @@ -20,6 +21,13 @@ public function email()
/** @var InboundEmail $modelClass */
$modelClass = config('mailbox.model');

return $modelClass::fromMessage($this->get('email'));
// Decode the base64 encoded message if the base64 parameter is true
if ($this->get('base64')) {
$message = base64_decode($this->get('message'));
} else {
$message = $this->get('message');
}

return $modelClass::fromMessage($message);
}
}

0 comments on commit c9d12c2

Please sign in to comment.