aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/RemoteImageController.cs
diff options
context:
space:
mode:
authorDavid <daullmer@gmail.com>2021-03-07 14:43:28 +0100
committerDavid <daullmer@gmail.com>2021-03-07 14:43:28 +0100
commit60ffa6f514656ed7256b555d483771c36164fce7 (patch)
tree537e88ee08f272b46f70a339c26d0d11e9487ee4 /Jellyfin.Api/Controllers/RemoteImageController.cs
parent22402650cb7668aaa74bfc2e7368aee50bf20542 (diff)
Use FileShare.None when creating files
Diffstat (limited to 'Jellyfin.Api/Controllers/RemoteImageController.cs')
-rw-r--r--Jellyfin.Api/Controllers/RemoteImageController.cs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Jellyfin.Api/Controllers/RemoteImageController.cs b/Jellyfin.Api/Controllers/RemoteImageController.cs
index 5284888d8..e226adc64 100644
--- a/Jellyfin.Api/Controllers/RemoteImageController.cs
+++ b/Jellyfin.Api/Controllers/RemoteImageController.cs
@@ -259,7 +259,8 @@ namespace Jellyfin.Api.Controllers
var fullCacheDirectory = Path.GetDirectoryName(fullCachePath) ?? throw new ResourceNotFoundException($"Provided path ({fullCachePath}) is not valid.");
Directory.CreateDirectory(fullCacheDirectory);
- await using var fileStream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
+ // use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
+ await using var fileStream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, true);
await response.Content.CopyToAsync(fileStream).ConfigureAwait(false);
var pointerCacheDirectory = Path.GetDirectoryName(pointerCachePath) ?? throw new ArgumentException($"Provided path ({pointerCachePath}) is not valid.", nameof(pointerCachePath));