File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 66use Illuminate \Support \Facades \Route ;
77use Illuminate \Cache \RateLimiting \Limit ;
88use Illuminate \Support \Facades \RateLimiter ;
9+ use Pterodactyl \Http \Middleware \TrimStrings ;
910use Illuminate \Foundation \Support \Providers \RouteServiceProvider as ServiceProvider ;
1011
1112class RouteServiceProvider extends ServiceProvider
1213{
14+ protected const FILE_PATH_REGEX = '/^\/api\/client\/servers\/([a-z0-9-]{36})\/files(\/?$|\/(.)*$)/i ' ;
15+
1316 /**
1417 * Define your route model bindings, pattern filters, etc.
1518 */
1619 public function boot ()
1720 {
1821 $ this ->configureRateLimiting ();
1922
23+ // Disable trimming string values when requesting file information — it isn't helpful
24+ // and messes up the ability to actually open a directory that ends with a space.
25+ TrimStrings::skipWhen (function (Request $ request ) {
26+ return preg_match (self ::FILE_PATH_REGEX , $ request ->getPathInfo ()) === 1 ;
27+ });
28+
2029 $ this ->routes (function () {
2130 Route::middleware (['web ' , 'csrf ' ])->group (function () {
2231 Route::middleware ('auth ' )->group (base_path ('routes/base.php ' ));
You can’t perform that action at this time.
0 commit comments