check attributes before saving over image file
This commit is contained in:
parent
cbd767ddce
commit
14c464c28a
|
@ -102,6 +102,18 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|||
|
||||
using (source)
|
||||
{
|
||||
// If the file is currently hidden we'll have to remove that or the save will fail
|
||||
var file = new FileInfo(path);
|
||||
|
||||
// This will fail if the file is hidden
|
||||
if (file.Exists)
|
||||
{
|
||||
if ((file.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
|
||||
{
|
||||
file.Attributes &= ~FileAttributes.Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous))
|
||||
{
|
||||
await source.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
|
||||
|
|
Loading…
Reference in New Issue
Block a user