Don't trim strings on file manager endpoints; ref #4081
This commit is contained in:
parent
d0b6ae00dc
commit
05f41a2ca8
1 changed files with 9 additions and 0 deletions
|
@ -6,10 +6,13 @@ use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Cache\RateLimiting\Limit;
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Pterodactyl\Http\Middleware\TrimStrings;
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
protected const FILE_PATH_REGEX = '/^\/api\/client\/servers\/([a-z0-9-]{36})\/files(\/?$|\/(.)*$)/i';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define your route model bindings, pattern filters, etc.
|
* Define your route model bindings, pattern filters, etc.
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +20,12 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
$this->configureRateLimiting();
|
$this->configureRateLimiting();
|
||||||
|
|
||||||
|
// Disable trimming string values when requesting file information — it isn't helpful
|
||||||
|
// and messes up the ability to actually open a directory that ends with a space.
|
||||||
|
TrimStrings::skipWhen(function (Request $request) {
|
||||||
|
return preg_match(self::FILE_PATH_REGEX, $request->getPathInfo()) === 1;
|
||||||
|
});
|
||||||
|
|
||||||
$this->routes(function () {
|
$this->routes(function () {
|
||||||
Route::middleware(['web', 'csrf'])->group(function () {
|
Route::middleware(['web', 'csrf'])->group(function () {
|
||||||
Route::middleware('auth')->group(base_path('routes/base.php'));
|
Route::middleware('auth')->group(base_path('routes/base.php'));
|
||||||
|
|
Loading…
Reference in a new issue