Merge pull request #670 from sbwalker/master

fix regression bug caused by #649 related to installing nupkg packages
This commit is contained in:
Shaun Walker 2020-08-06 13:10:51 -07:00 committed by GitHub
commit 35f186b532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,24 +126,14 @@ namespace Oqtane.Infrastructure
{
Directory.CreateDirectory(Path.GetDirectoryName(filename));
}
if (!FileInUse(filename) == false)
try
{
entry.ExtractToFile(filename, true);
}
}
private static bool FileInUse(string path)
{
try
{
using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
{
var flag = fs.CanWrite;
}
return false;
}
catch
{
return true;
// an error occurred extracting the file
}
}