Skip to content

Commit 1ed419c

Browse files
author
momijizukamori
committed
Don't allow non-utf8 seaches
1 parent 29c8e54 commit 1ed419c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

app/Http/Requests/Api/SearchRequest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ protected function prepareForValidation()
5858
if (empty($this->sort) || !valid_sort($this->sort)) {
5959
$this->merge(['sort' => 'added_new']);
6060
}
61+
if (!mb_detect_encoding($this->search, 'utf-8', true)) {
62+
$this->merge(['search' => null]);
63+
}
6164
}
6265

6366

app/Http/Requests/SearchRequest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ protected function prepareForValidation()
4949
if (empty($this->sort) || !valid_sort($this->sort)) {
5050
$this->merge(['sort' => 'added_new']);
5151
}
52+
if (!mb_detect_encoding($this->search, 'utf-8', true)) {
53+
$this->merge(['search' => null]);
54+
}
5255
}
5356

5457
/**

0 commit comments

Comments
 (0)