diff --git a/app/Lib/Filter.php b/app/Lib/Filter.php index d295951c..ce855661 100644 --- a/app/Lib/Filter.php +++ b/app/Lib/Filter.php @@ -24,7 +24,7 @@ abstract class Filter extends Data public static function fromRequest(array|string|null $request = null): static { $payload = is_string($request) - ? json_decode(base64_decode($request), true) + ? json_decode(rawurldecode(base64_decode($request)), true) : $request; return static::fromPost($payload); diff --git a/resources/js/mixins/indexHelpers.js b/resources/js/mixins/indexHelpers.js index 8da5f9b4..d29e800c 100644 --- a/resources/js/mixins/indexHelpers.js +++ b/resources/js/mixins/indexHelpers.js @@ -9,7 +9,7 @@ export default { }, computed: { filterString() { - return btoa(JSON.stringify(this.inner.meta.filter)); + return btoa(encodeURIComponent(JSON.stringify(this.inner.meta.filter))); }, }, methods: { diff --git a/tests/Feature/Member/IndexTest.php b/tests/Feature/Member/IndexTest.php index 16e37fa3..b851d9b6 100644 --- a/tests/Feature/Member/IndexTest.php +++ b/tests/Feature/Member/IndexTest.php @@ -192,9 +192,9 @@ class IndexTest extends TestCase { $this->withoutExceptionHandling()->login()->loginNami(); - $searchResponse = $this->callFilter('member.index', ['search' => 'Max']); + $searchResponse = $this->callFilter('member.index', ['search' => 'Maxö']); - $this->assertInertiaHas('Max', $searchResponse, 'data.meta.filter.search'); + $this->assertInertiaHas('Maxö', $searchResponse, 'data.meta.filter.search'); } public function testItLoadsGroups(): void diff --git a/tests/Lib/MakesHttpCalls.php b/tests/Lib/MakesHttpCalls.php index 83c35276..4376928c 100644 --- a/tests/Lib/MakesHttpCalls.php +++ b/tests/Lib/MakesHttpCalls.php @@ -20,7 +20,7 @@ trait MakesHttpCalls public function filterUrl(string $routeName, array $filter): string { $params = [ - 'filter' => base64_encode(json_encode($filter)), + 'filter' => base64_encode(rawurlencode(json_encode($filter))), ]; return route($routeName, $params);