File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed
app/Http/Requests/Api/Application Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa
33
44This project follows [ Semantic Versioning] ( http://semver.org ) guidelines.
55
6+ ## v0.7.2 (Derelict Dermodactylus)
7+ ### Fixed
8+ * Fixes an exception thrown when trying to access the ` /nests/:id/eggs/:id ` API endpoint.
9+
610## v0.7.1 (Derelict Dermodactylus)
711### Fixed
812* Fixes an exception when no token is entered on the 2-Factor enable/disable page and the form is submitted.
Original file line number Diff line number Diff line change 99use Pterodactyl \Exceptions \PterodactylException ;
1010use Pterodactyl \Http \Middleware \Api \ApiSubstituteBindings ;
1111use Symfony \Component \HttpKernel \Exception \NotFoundHttpException ;
12+ use Symfony \Component \Routing \Exception \InvalidParameterException ;
1213
1314abstract class ApplicationApiRequest extends FormRequest
1415{
@@ -76,22 +77,23 @@ public function key(): ApiKey
7677 }
7778
7879 /**
79- * Grab a model from the route parameters. If no model exists under
80- * the specified key a default response is returned .
80+ * Grab a model from the route parameters. If no model is found in the
81+ * binding mappings an exception will be thrown .
8182 *
8283 * @param string $model
83- * @param mixed $default
8484 * @return mixed
85+ *
86+ * @throws \Symfony\Component\Routing\Exception\InvalidParameterException
8587 */
86- public function getModel (string $ model, $ default = null )
88+ public function getModel (string $ model )
8789 {
8890 $ parameterKey = array_get (array_flip (ApiSubstituteBindings::getMappings ()), $ model );
8991
90- if (! is_null ($ parameterKey )) {
91- $ model = $ this -> route ()-> parameter ( $ parameterKey ) ;
92+ if (is_null ($ parameterKey )) {
93+ throw new InvalidParameterException ;
9294 }
9395
94- return $ model ?? $ default ;
96+ return $ this -> route ()-> parameter ( $ parameterKey ) ;
9597 }
9698
9799 /*
Original file line number Diff line number Diff line change 22
33namespace Pterodactyl \Http \Requests \Api \Application \Nests \Eggs ;
44
5+ use Pterodactyl \Models \Egg ;
6+ use Pterodactyl \Models \Nest ;
57use Pterodactyl \Services \Acl \Api \AdminAcl ;
68use Pterodactyl \Http \Requests \Api \Application \ApplicationApiRequest ;
79
@@ -24,6 +26,6 @@ class GetEggRequest extends ApplicationApiRequest
2426 */
2527 public function resourceExists (): bool
2628 {
27- return $ this ->getModel (' nest ' )->id === $ this ->getModel (' egg ' )->nest_id ;
29+ return $ this ->getModel (Nest::class )->id === $ this ->getModel (Egg::class )->nest_id ;
2830 }
2931}
You can’t perform that action at this time.
0 commit comments