aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/SystemController.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-09-01 17:26:49 -0600
committercrobibero <cody@robibe.ro>2020-09-01 17:26:49 -0600
commit2f33bee2a94f7175050f83d568f8bd65a01a86f8 (patch)
tree69ca62c6fa2291de284a28da59c35b6f2baa45ac /Jellyfin.Api/Controllers/SystemController.cs
parent2d198292a3ff1a5d213c9dd4643eee6ddef2661e (diff)
Set openapi schema type to file where possible
Diffstat (limited to 'Jellyfin.Api/Controllers/SystemController.cs')
-rw-r--r--Jellyfin.Api/Controllers/SystemController.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Jellyfin.Api/Controllers/SystemController.cs b/Jellyfin.Api/Controllers/SystemController.cs
index bbfd163de..256f39d0c 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,16 +192,13 @@ 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)
.First(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
- // 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");
+ return File(file.FullName, MediaTypeNames.Text.Plain);
}
/// <summary>