. dot not possible in url param

Hello, I just wanted to install a cool function for a sales department. The URL query parameters should be automatically inserted into the form:
protected function fillForm(): void
{
parent::fillForm();
$this->form->fill(request()->query());
}
protected function fillForm(): void
{
parent::fillForm();
$this->form->fill(request()->query());
}
But as soon as there is a dot in the URL, for example in the e-mail address, I get a 404
/create?first_name=John&last_name=Doe&email=johndoe%40example.com
/create?first_name=John&last_name=Doe&email=johndoe%40example.com
No description
14 Replies
taka92
taka922mo ago
Hello, @John Wink I have some solutions to fix your bug there are some ways to fix it
John Wink
John WinkOP2mo ago
I am grateful for any solution
toeknee
toeknee2mo ago
Where are you getting the qurl query parameters from? The same application from lead for example?
taka92
taka922mo ago
Add constraints to ensure that URL parameters can include dots Route::get('/create', [YourController::class, 'create']) ->where('email', '.*'); like this
John Wink
John WinkOP2mo ago
This is a Filament Resource CreatePage
TheRealTeeHill
TheRealTeeHill2mo ago
so %40 for the @ symbol works...? couldn't you pass in %2E for the . ? maybe URL encode the entire string?
Mohamed Ayaou
Mohamed Ayaou2mo ago
Just encode your URLs and then decode them again when needed
John Wink
John WinkOP2mo ago
I have already tried it. Unfortunately, encoding and decoding dots does not work. this is a filament route not a custom route.
Mohamed Ayaou
Mohamed Ayaou2mo ago
Why, isn't the '@' encoded successfully in this example? /create?first_name=John&last_name=Doe&email=johndoe%40example.com try this:
$this->form->fill(
collect(request()->query())->mapWithKeys(function ($value, $key) {
return [$key => htmlspecialchars($value, ENT_QUOTES, 'UTF-8')];
})->toArray()
);
$this->form->fill(
collect(request()->query())->mapWithKeys(function ($value, $key) {
return [$key => htmlspecialchars($value, ENT_QUOTES, 'UTF-8')];
})->toArray()
);
not tested btw
John Wink
John WinkOP2mo ago
If I enter @ in the URL, it automatically becomes %40 dot does not work even with your new solution because it does not arrive at this function at all. There seems to be an error in the compiler of the route. I have found a workaround
John Wink
John WinkOP2mo ago
No description
John Wink
John WinkOP2mo ago
I have created a new HostValidator and there I cut out the additional string that is added as soon as there is a dot in the query parameters.
John Wink
John WinkOP2mo ago
No description

Did you find this page helpful?