ClientEventLogger.cs (jellyfin-10.8.9) | : | ClientEventLogger.cs (jellyfin-10.8.10) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
public ClientEventLogger(IServerApplicationPaths applicationPaths) | public ClientEventLogger(IServerApplicationPaths applicationPaths) | |||
{ | { | |||
_applicationPaths = applicationPaths; | _applicationPaths = applicationPaths; | |||
} | } | |||
/// <inheritdoc /> | /// <inheritdoc /> | |||
public async Task<string> WriteDocumentAsync(string clientName, string c lientVersion, Stream fileContents) | public async Task<string> WriteDocumentAsync(string clientName, string c lientVersion, Stream fileContents) | |||
{ | { | |||
var fileName = $"upload_{clientName}_{clientVersion}_{DateTime.UtcNo w:yyyyMMddHHmmss}_{Guid.NewGuid():N}.log"; | var fileName = $"upload_{clientName}_{clientVersion}_{DateTime.UtcNo w:yyyyMMddHHmmss}_{Guid.NewGuid():N}.log"; | |||
var logFilePath = Path.Combine(_applicationPaths.LogDirectoryPath, f ileName); | var logFilePath = Path.Combine(_applicationPaths.LogDirectoryPath, f ileName); | |||
if (!Path.GetFullPath(logFilePath).StartsWith(_applicationPaths.LogD | ||||
irectoryPath, StringComparison.Ordinal)) | ||||
{ | ||||
throw new ArgumentException("Path resolved to filename not in lo | ||||
g directory"); | ||||
} | ||||
await using var fileStream = new FileStream(logFilePath, FileMode.Cr eateNew, FileAccess.Write, FileShare.None); | await using var fileStream = new FileStream(logFilePath, FileMode.Cr eateNew, FileAccess.Write, FileShare.None); | |||
await fileContents.CopyToAsync(fileStream).ConfigureAwait(false); | await fileContents.CopyToAsync(fileStream).ConfigureAwait(false); | |||
return fileName; | return fileName; | |||
} | } | |||
} | } | |||
} | } | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 7 lines changed or added |