aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/VideoAttachmentsController.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-05-19 13:02:02 -0600
committercrobibero <cody@robibe.ro>2020-05-19 13:02:02 -0600
commit51d54a8ca40f987bce877ad1d7dc78b1cb26b8a3 (patch)
tree9f75a186c6a1e179bb8663c76048942b85d9dcef /Jellyfin.Api/Controllers/VideoAttachmentsController.cs
parentb28dd47a0fc5b18111678acede335474f9007b8f (diff)
Fix return content type
Diffstat (limited to 'Jellyfin.Api/Controllers/VideoAttachmentsController.cs')
-rw-r--r--Jellyfin.Api/Controllers/VideoAttachmentsController.cs14
1 files changed, 7 insertions, 7 deletions
diff --git a/Jellyfin.Api/Controllers/VideoAttachmentsController.cs b/Jellyfin.Api/Controllers/VideoAttachmentsController.cs
index a10dd4059..596d21190 100644
--- a/Jellyfin.Api/Controllers/VideoAttachmentsController.cs
+++ b/Jellyfin.Api/Controllers/VideoAttachmentsController.cs
@@ -1,11 +1,13 @@
#nullable enable
using System;
+using System.Net.Mime;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
+using MediaBrowser.Model.Net;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -17,7 +19,7 @@ namespace Jellyfin.Api.Controllers
/// </summary>
[Route("Videos")]
[Authorize]
- public class VideoAttachmentsController : Controller
+ public class VideoAttachmentsController : BaseJellyfinApiController
{
private readonly ILibraryManager _libraryManager;
private readonly IAttachmentExtractor _attachmentExtractor;
@@ -45,7 +47,7 @@ namespace Jellyfin.Api.Controllers
/// <response code="404">Video or attachment not found.</response>
/// <returns>An <see cref="FileStreamResult"/> containing the attachment stream on success, or a <see cref="NotFoundResult"/> if the attachment could not be found.</returns>
[HttpGet("{VideoID}/{MediaSourceID}/Attachments/{Index}")]
- [Produces("application/octet-stream")]
+ [Produces(MediaTypeNames.Application.Octet)]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<FileStreamResult>> GetAttachment(
@@ -68,11 +70,9 @@ namespace Jellyfin.Api.Controllers
CancellationToken.None)
.ConfigureAwait(false);
- var contentType = "application/octet-stream";
- if (string.IsNullOrWhiteSpace(attachment.MimeType))
- {
- contentType = attachment.MimeType;
- }
+ var contentType = string.IsNullOrWhiteSpace(attachment.MimeType)
+ ? MediaTypeNames.Application.Octet
+ : attachment.MimeType;
return new FileStreamResult(stream, contentType);
}