mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Add try catch (#14154)
This commit is contained in:
parent
a702b62553
commit
9ab22e9f8b
@ -450,6 +450,8 @@ public class PlaylistsController : BaseJellyfinApiController
|
|||||||
{
|
{
|
||||||
var callingUserId = User.GetUserId();
|
var callingUserId = User.GetUserId();
|
||||||
|
|
||||||
|
if (!callingUserId.IsEmpty())
|
||||||
|
{
|
||||||
var playlist = _playlistManager.GetPlaylistForUser(Guid.Parse(playlistId), callingUserId);
|
var playlist = _playlistManager.GetPlaylistForUser(Guid.Parse(playlistId), callingUserId);
|
||||||
if (playlist is null)
|
if (playlist is null)
|
||||||
{
|
{
|
||||||
@ -463,10 +465,27 @@ public class PlaylistsController : BaseJellyfinApiController
|
|||||||
{
|
{
|
||||||
return Forbid();
|
return Forbid();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var isApiKey = User.GetIsApiKey();
|
||||||
|
|
||||||
|
if (!isApiKey)
|
||||||
|
{
|
||||||
|
return Forbid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
await _playlistManager.RemoveItemFromPlaylistAsync(playlistId, entryIds).ConfigureAwait(false);
|
await _playlistManager.RemoveItemFromPlaylistAsync(playlistId, entryIds).ConfigureAwait(false);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the original items of a playlist.
|
/// Gets the original items of a playlist.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user