diff --git a/src/QueryBuilder/QueryBuilderTrait.php b/src/QueryBuilder/QueryBuilderTrait.php index 6993ce2..4fec8b1 100755 --- a/src/QueryBuilder/QueryBuilderTrait.php +++ b/src/QueryBuilder/QueryBuilderTrait.php @@ -12,6 +12,7 @@ use Darksparrow\DeegraphInteractions\QueryBuilder\PermissionsQuery\PermissionQue use Darksparrow\DeegraphInteractions\QueryBuilder\PutQuery\PutQueryBuilder; use Darksparrow\DeegraphInteractions\QueryBuilder\ReferencesQuery\ReferencesQueryBuilder; use Darksparrow\DeegraphInteractions\QueryBuilder\SelectQuery\SelectQueryBuilder; +use Darksparrow\DeegraphInteractions\Utilities\RelativePath; use ReflectionClass; trait QueryBuilderTrait @@ -31,7 +32,7 @@ trait QueryBuilderTrait protected function ValidateDeegraphPath(string $target): string { - if (!preg_match(pattern: "/(^(\{[0-9a-f]{8}\b-[0-9a-f]{4}\b-[0-9a-f]{4}\b-[0-9a-f]{4}\b-[0-9a-f]{12}\})$)|(^\{[0-9a-f]{8}\b-[0-9a-f]{4}\b-[0-9a-f]{4}\b-[0-9a-f]{4}\b-[0-9a-f]{12}\}(\/([a-z][a-z0-9]*|[0-9]+|#|\*))+$)|(^(([a-z][a-z0-9]*|[0-9]+|#|\*))(\/([a-z][a-z0-9]*|[0-9]+|#|\*))*$)/", subject: $target)) + if (!RelativePath::Validate($target)) throw new QueryBuilderInvalidInputException(); return $target; } diff --git a/src/Utilities/RelativePath.php b/src/Utilities/RelativePath.php new file mode 100644 index 0000000..900cc26 --- /dev/null +++ b/src/Utilities/RelativePath.php @@ -0,0 +1,15 @@ +