mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-03 05:34:16 -04:00
Added Required attribute to Text property of MessageCommand.
This commit is contained in:
parent
998833ea6e
commit
ca25301e64
@ -323,13 +323,6 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[FromRoute, Required] string sessionId,
|
[FromRoute, Required] string sessionId,
|
||||||
[FromBody, Required] MessageCommand command)
|
[FromBody, Required] MessageCommand command)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Need to check if message.Text is null, since [Required] can't be applied to properties of a deserialized object.
|
|
||||||
if (string.IsNullOrWhiteSpace(command.Text))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Message Text may not be empty.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var nullCorrectedCommand = new MessageCommand
|
var nullCorrectedCommand = new MessageCommand
|
||||||
{
|
{
|
||||||
Header = string.IsNullOrWhiteSpace(command.Header) ? "Message from Server" : command.Header,
|
Header = string.IsNullOrWhiteSpace(command.Header) ? "Message from Server" : command.Header,
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Session
|
namespace MediaBrowser.Model.Session
|
||||||
{
|
{
|
||||||
public class MessageCommand
|
public class MessageCommand
|
||||||
{
|
{
|
||||||
public string Header { get; set; }
|
public string Header { get; set; }
|
||||||
|
[Required(AllowEmptyStrings = false)]
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
|
||||||
public long? TimeoutMs { get; set; }
|
public long? TimeoutMs { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user