Skip to content

Commit

Permalink
apply Purify for rich_text
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragchhatrala committed Nov 27, 2024
1 parent 0019ed2 commit 965c5f2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/app/Http/Requests/AnswerFormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
use Stevebauman\Purify\Facades\Purify;

class AnswerFormRequest extends FormRequest
{
Expand Down Expand Up @@ -275,6 +276,10 @@ protected function prepareForValidation()
if ($property['type'] === 'phone_number' && (!isset($property['use_simple_text_input']) || !$property['use_simple_text_input']) && $receivedValue && in_array($receivedValue, $countryCodeMapper)) {
$mergeData[$property['id']] = null;
}

if ($property['type'] === 'rich_text' && $receivedValue) {
$mergeData[$property['id']] = Purify::clean($receivedValue);
}
});

$this->merge($mergeData);
Expand Down

0 comments on commit 965c5f2

Please sign in to comment.