From 7e836ad4f9273cb27ed56fb17b978981d55a3ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Sat, 2 Dec 2023 13:24:15 +0100 Subject: [PATCH] throw http 400 if both track and encodedTrack/identifier is set --- .../src/main/java/lavalink/server/player/PlayerRestHandler.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/PlayerRestHandler.kt b/LavalinkServer/src/main/java/lavalink/server/player/PlayerRestHandler.kt index 2b7dd23a6..6a837dbf5 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/PlayerRestHandler.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/PlayerRestHandler.kt @@ -59,6 +59,10 @@ class PlayerRestHandler( ): ResponseEntity { val context = socketContext(socketServer, sessionId) + if (playerUpdate.track.isPresent() && (playerUpdate.encodedTrack is Omissible.Present || playerUpdate.identifier is Omissible.Present)) { + throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Cannot specify both track and encodedTrack/identifier") + } + val track = if (playerUpdate.track.isPresent()) { playerUpdate.track } else {