Move throw into interface to use in wizard, check for null and invalid username.

This commit is contained in:
Jxiced
2025-02-23 22:16:35 +00:00
parent 7aa96dfc20
commit e7bc86ebb8
3 changed files with 13 additions and 9 deletions

View File

@@ -176,10 +176,6 @@ namespace Jellyfin.Server.Implementations.Users
/// <inheritdoc/>
public async Task UpdateUserAsync(User user)
{
ArgumentNullException.ThrowIfNull(user);
ThrowIfInvalidUsername(user.Username);
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
await using (dbContext.ConfigureAwait(false))
{
@@ -737,7 +733,8 @@ namespace Jellyfin.Server.Implementations.Users
_users[user.Id] = user;
}
internal static void ThrowIfInvalidUsername(string name)
/// <inheritdoc/>
public void ThrowIfInvalidUsername(string name)
{
if (!string.IsNullOrWhiteSpace(name) && ValidUsernameRegex().IsMatch(name))
{