File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
app/Http/Controllers/Api/Remote/Backups Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -32,14 +32,21 @@ public function __construct(private BackupManager $backupManager)
3232 */
3333 public function __invoke (Request $ request , string $ backup ): JsonResponse
3434 {
35+ // Get the node associated with the request.
36+ /** @var \Pterodactyl\Models\Node $node */
37+ $ node = $ request ->attributes ->get ('node ' );
38+
3539 // Get the size query parameter.
3640 $ size = (int ) $ request ->query ('size ' );
3741 if (empty ($ size )) {
3842 throw new BadRequestHttpException ('A non-empty "size" query parameter must be provided. ' );
3943 }
4044
4145 /** @var \Pterodactyl\Models\Backup $backup */
42- $ backup = Backup::query ()->where ('uuid ' , $ backup )->firstOrFail ();
46+ $ backup = Backup::query ()
47+ ->where ('node_id ' , $ node ->id )
48+ ->where ('uuid ' , $ backup )
49+ ->firstOrFail ();
4350
4451 // Prevent backups that have already been completed from trying to
4552 // be uploaded again.
Original file line number Diff line number Diff line change @@ -30,8 +30,15 @@ public function __construct(private BackupManager $backupManager)
3030 */
3131 public function index (ReportBackupCompleteRequest $ request , string $ backup ): JsonResponse
3232 {
33- /** @var \Pterodactyl\Models\Backup $model */
34- $ model = Backup::query ()->where ('uuid ' , $ backup )->firstOrFail ();
33+ // Get the node associated with the request.
34+ /** @var \Pterodactyl\Models\Node $node */
35+ $ node = $ request ->attributes ->get ('node ' );
36+
37+ /** @var \Pterodactyl\Models\Backup $backup */
38+ $ backup = Backup::query ()
39+ ->where ('node_id ' , $ node ->id )
40+ ->where ('uuid ' , $ backup )
41+ ->firstOrFail ();
3542
3643 if ($ model ->is_successful ) {
3744 throw new BadRequestHttpException ('Cannot update the status of a backup that is already marked as completed. ' );
You can’t perform that action at this time.
0 commit comments