aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Users/UserManager.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2023-09-23 16:14:03 -0600
committerCody Robibero <cody@robibe.ro>2023-09-23 16:14:03 -0600
commitbc88c96cbe13301ee6e5f6a2d688a4c90338281d (patch)
tree368daf4d214df0726c9d60d0942dcd68ed75a37f /Jellyfin.Server.Implementations/Users/UserManager.cs
parentba7e3bfd82aeee3c74a99fa1f4ca94deca8b4dbe (diff)
Validate cast receiver id on get/set
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
-rw-r--r--Jellyfin.Server.Implementations/Users/UserManager.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs
index 2a38fcecc..108d2fad4 100644
--- a/Jellyfin.Server.Implementations/Users/UserManager.cs
+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs
@@ -328,7 +328,8 @@ namespace Jellyfin.Server.Implementations.Users
LatestItemsExcludes = user.GetPreferenceValues<Guid>(PreferenceKind.LatestItemExcludes),
CastReceiverId = string.IsNullOrEmpty(user.CastReceiverId)
? _serverConfigurationManager.Configuration.CastReceiverApplications.FirstOrDefault()?.Id
- : user.CastReceiverId
+ : _serverConfigurationManager.Configuration.CastReceiverApplications.FirstOrDefault(c => string.Equals(c.Id, user.CastReceiverId, StringComparison.Ordinal))?.Id
+ ?? _serverConfigurationManager.Configuration.CastReceiverApplications.FirstOrDefault()?.Id
},
Policy = new UserPolicy
{
@@ -616,7 +617,10 @@ namespace Jellyfin.Server.Implementations.Users
user.EnableNextEpisodeAutoPlay = config.EnableNextEpisodeAutoPlay;
user.RememberSubtitleSelections = config.RememberSubtitleSelections;
user.SubtitleLanguagePreference = config.SubtitleLanguagePreference;
- if (!string.IsNullOrEmpty(config.CastReceiverId))
+
+ // Only set cast receiver id if it is passed in and it exists in the server config.
+ if (!string.IsNullOrEmpty(config.CastReceiverId)
+ && _serverConfigurationManager.Configuration.CastReceiverApplications.Any(c => string.Equals(c.Id, config.CastReceiverId, StringComparison.Ordinal)))
{
user.CastReceiverId = config.CastReceiverId;
}