Просмотр исходного кода

Always attempt to get User if a user id is provided (#11471)

Cody Robibero 1 год назад
Родитель
Сommit
1accfd79da
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      Jellyfin.Api/Controllers/ItemsController.cs

+ 3 - 3
Jellyfin.Api/Controllers/ItemsController.cs

@@ -246,9 +246,9 @@ public class ItemsController : BaseJellyfinApiController
         var isApiKey = User.GetIsApiKey();
         // if api key is used (auth.IsApiKey == true), then `user` will be null throughout this method
         userId = RequestHelpers.GetUserId(User, userId);
-        var user = !isApiKey && !userId.IsNullOrEmpty()
-            ? _userManager.GetUserById(userId.Value) ?? throw new ResourceNotFoundException()
-            : null;
+        var user = userId.IsNullOrEmpty()
+            ? null
+            : _userManager.GetUserById(userId.Value) ?? throw new ResourceNotFoundException();
 
         // beyond this point, we're either using an api key or we have a valid user
         if (!isApiKey && user is null)