aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/SystemController.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2020-09-09 20:20:35 +0000
committerGitHub <noreply@github.com>2020-09-09 20:20:35 +0000
commit621f3b705052f628e27fb975a8bb809853742ad8 (patch)
treed7c84c5598aafdc2d3fd502b940339423e84ff33 /Jellyfin.Api/Controllers/SystemController.cs
parentb76d4ba454c43cc6293b733f2bba363e34a9bf5e (diff)
parent25ac778a79c7ff39433db2acd92788e26228879f (diff)
Merge pull request #4037 from crobibero/api-stream-return
Set openapi schema type to file where possible
Diffstat (limited to 'Jellyfin.Api/Controllers/SystemController.cs')
-rw-r--r--Jellyfin.Api/Controllers/SystemController.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Jellyfin.Api/Controllers/SystemController.cs b/Jellyfin.Api/Controllers/SystemController.cs
index bbfd163de..e878e8f36 100644
--- a/Jellyfin.Api/Controllers/SystemController.cs
+++ b/Jellyfin.Api/Controllers/SystemController.cs
@@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
+using System.Net.Mime;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Api.Attributes;
using Jellyfin.Api.Constants;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
@@ -190,6 +192,7 @@ namespace Jellyfin.Api.Controllers
[HttpGet("Logs/Log")]
[Authorize(Policy = Policies.RequiresElevation)]
[ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesFile(MediaTypeNames.Text.Plain)]
public ActionResult GetLogFile([FromQuery, Required] string? name)
{
var file = _fileSystem.GetFiles(_appPaths.LogDirectoryPath)
@@ -197,7 +200,6 @@ namespace Jellyfin.Api.Controllers
// For older files, assume fully static
var fileShare = file.LastWriteTimeUtc < DateTime.UtcNow.AddHours(-1) ? FileShare.Read : FileShare.ReadWrite;
-
FileStream stream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, fileShare);
return File(stream, "text/plain");
}