mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 21:08:27 +01:00
Suggestions from review
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Model.ClientLog;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -43,10 +44,9 @@ namespace MediaBrowser.Controller.ClientEvent
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task WriteFileAsync(string fileName, Stream fileContents)
|
||||
public async Task WriteDocumentAsync(AuthorizationInfo authorizationInfo, Stream fileContents)
|
||||
{
|
||||
// Force naming convention: upload_YYYYMMDD_$name
|
||||
fileName = $"upload_{DateTime.UtcNow:yyyyMMdd}_{fileName}";
|
||||
var fileName = $"upload_{authorizationInfo.Client}_{authorizationInfo.Version}_{DateTime.UtcNow:yyyyMMddHHmmss}.log";
|
||||
var logFilePath = Path.Combine(_applicationPaths.LogDirectoryPath, fileName);
|
||||
await using var fileStream = new FileStream(logFilePath, FileMode.CreateNew, FileAccess.Write, FileShare.None);
|
||||
await fileContents.CopyToAsync(fileStream).ConfigureAwait(false);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Model.ClientLog;
|
||||
|
||||
namespace MediaBrowser.Controller.ClientEvent
|
||||
@@ -18,9 +19,9 @@ namespace MediaBrowser.Controller.ClientEvent
|
||||
/// <summary>
|
||||
/// Writes a file to the log directory.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The file name.</param>
|
||||
/// <param name="fileContents">The file contents.</param>
|
||||
/// <param name="authorizationInfo">The current authorization info.</param>
|
||||
/// <param name="fileContents">The file contents to write.</param>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
||||
Task WriteFileAsync(string fileName, Stream fileContents);
|
||||
Task WriteDocumentAsync(AuthorizationInfo authorizationInfo, Stream fileContents);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user