Merge pull request #5402 from Ullmie02/fix-null-size

Use FileShare.None when creating files

(cherry picked from commit 480dd66428)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Joshua M. Boniface
2021-03-07 19:37:21 -05:00
parent 42d0c1ac5f
commit a10eea41ac
16 changed files with 36 additions and 18 deletions

View File

@@ -133,7 +133,8 @@ namespace MediaBrowser.LocalMetadata.Savers
// On Windows, savint the file will fail if the file is hidden or readonly
FileSystem.SetAttributes(path, false, false);
using (var filestream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
using (var filestream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
{
stream.CopyTo(filestream);
}