aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Images/RemoteImageService.cs
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-04-26 11:44:42 -0400
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-04-26 11:44:42 -0400
commit93649ad77b1e6b005a9b7a33d4c82bbce6189ecc (patch)
tree225dc540a6166ed8ae13a4159cb1811a6c600f3c /MediaBrowser.Api/Images/RemoteImageService.cs
parent00a0e013c695a3741218985afadd31265a6ddb40 (diff)
parentf81833693d0cae476d923f704451bb794a78da8a (diff)
Merge remote-tracking branch 'upstream/master' into simplify-https-config
Diffstat (limited to 'MediaBrowser.Api/Images/RemoteImageService.cs')
-rw-r--r--MediaBrowser.Api/Images/RemoteImageService.cs26
1 files changed, 12 insertions, 14 deletions
diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.cs
index f03f5efd8..222bb34d3 100644
--- a/MediaBrowser.Api/Images/RemoteImageService.cs
+++ b/MediaBrowser.Api/Images/RemoteImageService.cs
@@ -261,27 +261,25 @@ namespace MediaBrowser.Api.Images
/// <returns>Task.</returns>
private async Task DownloadImage(string url, Guid urlHash, string pointerCachePath)
{
- using (var result = await _httpClient.GetResponse(new HttpRequestOptions
+ using var result = await _httpClient.GetResponse(new HttpRequestOptions
{
Url = url,
BufferContent = false
- }).ConfigureAwait(false))
- {
- var ext = result.ContentType.Split('/').Last();
-
- var fullCachePath = GetFullCachePath(urlHash + "." + ext);
+ }).ConfigureAwait(false);
+ var ext = result.ContentType.Split('/').Last();
- Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
- using (var stream = result.Content)
- using (var filestream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true))
- {
- await stream.CopyToAsync(filestream).ConfigureAwait(false);
- }
+ var fullCachePath = GetFullCachePath(urlHash + "." + ext);
- Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
- File.WriteAllText(pointerCachePath, fullCachePath);
+ Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
+ using (var stream = result.Content)
+ {
+ using var filestream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
+ await stream.CopyToAsync(filestream).ConfigureAwait(false);
}
+
+ Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
+ File.WriteAllText(pointerCachePath, fullCachePath);
}
/// <summary>