Skip to content

Commit

Permalink
API Use Symfony's Path class
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Sep 13, 2024
1 parent 5897c5a commit d733479
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
use SilverStripe\Control\Director;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Injector\InjectorNotFoundException;
use SilverStripe\Core\Path;
use SilverStripe\GraphQL\Schema\Schema;
use SilverStripe\Security\SecurityToken;
use SilverStripe\View\Requirements;
use Symfony\Component\Filesystem\Path;

class Controller extends BaseController
{
Expand Down Expand Up @@ -127,7 +127,7 @@ protected function findAvailableRoutes($schemas = []): array
$explicitSchema = $controllerInfo['Schema'] ?? null;
if ($explicitSchema) {
if ($schemas === '*' || in_array($explicitSchema, $schemas ?? [])) {
$routes[$explicitSchema] = Path::normalise($pattern, true);
$routes[$explicitSchema] = trim(Path::normalize($pattern), '/');
}
continue;
}
Expand All @@ -138,7 +138,7 @@ protected function findAvailableRoutes($schemas = []): array
? $routeController->getSchemaKey()
: $routeController->getManager()->getSchemaKey();
if ($schemas === '*' || in_array($schemaKey, $schemas ?? [])) {
$routes[$schemaKey] = Path::normalise($pattern, true);
$routes[$schemaKey] = trim(Path::normalize($pattern), '/');
}
}
} catch (InjectorNotFoundException $ex) {
Expand Down
4 changes: 2 additions & 2 deletions src/GraphQLSchemaInitTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Manifest\ModuleManifest;
use SilverStripe\Core\Path;
use SilverStripe\Dev\BuildTask;
use SilverStripe\GraphQL\Config\Configuration;
use Symfony\Component\Filesystem\Path;

/**
* A task that initialises a GraphQL 4+ schema with boilerplate config and files.
Expand Down Expand Up @@ -138,7 +138,7 @@ class: SilverStripe\GraphQL\Controller
SilverStripe\Control\Director:
rules:
$rules
SilverStripe\GraphQL\Schema\Schema:
schemas:
$this->schemaName:
Expand Down

0 comments on commit d733479

Please sign in to comment.