mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
fixes #255 - Access to the path is denied
This commit is contained in:
parent
1b75668d00
commit
6a740f7ea5
@ -269,7 +269,9 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
// Record the name of each file
|
||||
// Need to sort these because accoring to msdn docs, our i/o methods are not guaranteed in any order
|
||||
foreach (var file in ResolveArgs.FileSystemChildren.OrderBy(f => f.Name))
|
||||
foreach (var file in ResolveArgs.FileSystemChildren
|
||||
.Where(i => !i.Attributes.HasFlag(FileAttributes.System))
|
||||
.OrderBy(f => f.Name))
|
||||
{
|
||||
sb.Append(file.Name);
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ namespace MediaBrowser.Controller.IO
|
||||
|
||||
var dict = new Dictionary<string, FileSystemInfo>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var entries = new DirectoryInfo(path).EnumerateFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly)
|
||||
.Where(i => !i.Attributes.HasFlag(FileAttributes.System) && !i.Name.Equals(".") && !i.Name.Equals(".."));
|
||||
var entries = new DirectoryInfo(path).EnumerateFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
|
||||
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
|
@ -470,14 +470,6 @@ namespace MediaBrowser.Server.Implementations.Providers
|
||||
{
|
||||
using (dataToSave)
|
||||
{
|
||||
// If the file already exists but is hidden, the below save will throw an UnauthorizedAccessException
|
||||
var existingFileInfo = new FileInfo(path);
|
||||
|
||||
if (existingFileInfo.Exists && existingFileInfo.Attributes.HasFlag(FileAttributes.Hidden))
|
||||
{
|
||||
existingFileInfo.Delete();
|
||||
}
|
||||
|
||||
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous))
|
||||
{
|
||||
await dataToSave.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
|
||||
|
Loading…
Reference in New Issue
Block a user