Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: spark routes may show BadRequestException when a route has a regexp #8974

Merged

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 19, 2024

Description
Fixes #8972

--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -6,3 +6,4 @@ use CodeIgniter\Router\RouteCollection;
  * @var RouteCollection $routes
  */
 $routes->get('/', 'Home::index');
+$routes->options('picker/(.+)', 'Options::index');

Before:

$ ./spark routes

CodeIgniter v4.5.2 Command Line Tool - Server Time: 2024-06-19 03:40:45 UTC+00:00

[CodeIgniter\HTTP\Exceptions\BadRequestException]
The URI you submitted has disallowed characters: "(. )"
at SYSTEMPATH/Router/Router.php:736

Backtrace:
  1    SYSTEMPATH/Router/Router.php:203
       CodeIgniter\Router\Router()->checkDisallowedChars('picker/(. )')
...

After:

$ ./spark routes

CodeIgniter v4.5.2 Command Line Tool - Server Time: 2024-06-19 03:41:40 UTC+00:00

+---------+-------------+------+---------------------------------+----------------+---------------+
| Method  | Route       | Name | Handler                         | Before Filters | After Filters |
+---------+-------------+------+---------------------------------+----------------+---------------+
| GET     | /           | »    | \App\Controllers\Home::index    |                |               |
| OPTIONS | picker/(.+) | »    | \App\Controllers\Options::index | <unknown>      | <unknown>     |
+---------+-------------+------+---------------------------------+----------------+---------------+

Required Before Filters: forcehttps, pagecache
 Required After Filters: pagecache, performance, toolbar

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

E.g.,
CodeIgniter\HTTP\Exceptions\BadRequestException: The URI you submitted has disallowed characters: "(. )"
@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 19, 2024
@kenjis kenjis merged commit cd46db1 into codeigniter4:develop Jun 19, 2024
41 checks passed
@kenjis kenjis deleted the fix-spark-routes-BadRequestException branch June 19, 2024 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: spark routes doesn't work with (.+)
3 participants