Skip to content

Firefly III: a personal finances manager

Catch empty string.

James Cole7d7e1366a6f1
diff --git a/app/Api/V1/Controllers/Search/AccountController.php b/app/Api/V1/Controllers/Search/AccountController.php
index bc7adc0965..20fea66f3d 100644
--- a/app/Api/V1/Controllers/Search/AccountController.php
+++ b/app/Api/V1/Controllers/Search/AccountController.php
@@ -70,8 +70,8 @@ class AccountController extends Controller
{
Log::debug('Now in account search()');
$manager = $this->getManager();
- $query = $request->get('query');
- $field = $request->get('field');
+ $query = trim((string)$request->get('query'));
+ $field = trim((string)$request->get('field'));
$type = $request->get('type') ?? 'all';
if ('' === $query || !in_array($field, $this->validFields, true)) {
return response(null, 422);