mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 23:58:57 +00:00
Update documentation; use information from authorization; return generated filename
This commit is contained in:
@@ -44,13 +44,14 @@ namespace MediaBrowser.Controller.ClientEvent
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task WriteDocumentAsync(AuthorizationInfo authorizationInfo, Stream fileContents)
|
||||
public async Task<string> WriteDocumentAsync(AuthorizationInfo authorizationInfo, Stream fileContents)
|
||||
{
|
||||
var fileName = $"upload_{authorizationInfo.Client}_{(authorizationInfo.IsApiKey ? "apikey" : 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);
|
||||
await fileStream.FlushAsync().ConfigureAwait(false);
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace MediaBrowser.Controller.ClientEvent
|
||||
/// </summary>
|
||||
/// <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 WriteDocumentAsync(AuthorizationInfo authorizationInfo, Stream fileContents);
|
||||
/// <returns>The created file name.</returns>
|
||||
Task<string> WriteDocumentAsync(AuthorizationInfo authorizationInfo, Stream fileContents);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user