aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/SessionController.cs
diff options
context:
space:
mode:
authorNiels van Velzen <git@ndat.nl>2020-09-21 16:53:00 +0200
committerNiels van Velzen <git@ndat.nl>2020-09-21 16:56:22 +0200
commit3459655bb401595f62c21513964876b2f4549fed (patch)
treea989229e9119c2c7e009cca8a69321119788404d /Jellyfin.Api/Controllers/SessionController.cs
parent7da03d67a74f37734bf26e1b3dbe5a8672c328f9 (diff)
Use GeneralCommandType enum in GeneralCommand name
Diffstat (limited to 'Jellyfin.Api/Controllers/SessionController.cs')
-rw-r--r--Jellyfin.Api/Controllers/SessionController.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs
index b00675d67..5a2a3cdc0 100644
--- a/Jellyfin.Api/Controllers/SessionController.cs
+++ b/Jellyfin.Api/Controllers/SessionController.cs
@@ -217,16 +217,15 @@ namespace Jellyfin.Api.Controllers
[FromRoute, Required] string sessionId,
[FromRoute, Required] string command)
{
- var name = command;
- if (Enum.TryParse(name, true, out GeneralCommandType commandType))
+ if (!Enum.TryParse(command, true, out GeneralCommandType commandType))
{
- name = commandType.ToString();
+ return BadRequest();
}
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
var generalCommand = new GeneralCommand
{
- Name = name,
+ Name = commandType,
ControllingUserId = currentSession.UserId
};
@@ -249,11 +248,16 @@ namespace Jellyfin.Api.Controllers
[FromRoute, Required] string sessionId,
[FromRoute, Required] string command)
{
+ if (!Enum.TryParse(command, true, out GeneralCommandType commandType))
+ {
+ return BadRequest();
+ }
+
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
var generalCommand = new GeneralCommand
{
- Name = command,
+ Name = commandType,
ControllingUserId = currentSession.UserId
};