Remove DLL support and require all packages/plugins to be zip archives

This commit is contained in:
Claus Vium 2019-02-11 18:52:09 +01:00
parent 8fd9f5b6a4
commit da169dddb5

View file

@ -529,21 +529,18 @@ namespace Emby.Server.Implementations.Updates
private async Task PerformPackageInstallation(IProgress<double> progress, string target, PackageVersionInfo package, CancellationToken cancellationToken)
{
// Target based on if it is an archive or single assembly
var extension = Path.GetExtension(package.targetFilename);
var isArchive = string.Equals(extension, ".zip", StringComparison.OrdinalIgnoreCase);
if (!isArchive)
{
_logger.LogError("Only zip packages are supported. {Filename} is not a zip archive.", package.targetFilename);
return;
}
if (target == null)
{
if (isArchive)
{
target = Path.Combine(_appPaths.PluginsPath, Path.GetFileNameWithoutExtension(package.targetFilename));
}
else
{
target = Path.Combine(_appPaths.PluginsPath, package.targetFilename);
}
}
// Download to temporary file so that, if interrupted, it won't destroy the existing installation
var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions
@ -560,20 +557,12 @@ namespace Emby.Server.Implementations.Updates
// Success - move it to the real target
try
{
if (isArchive)
{
using (var stream = File.OpenRead(tempFile))
{
_zipClient.ExtractAllFromZip(stream, target, true);
}
}
else
{
Directory.CreateDirectory(Path.GetDirectoryName(target));
File.Copy(tempFile, target, true);
}
}
catch (IOException ex)
{
_logger.LogError(ex, "Error attempting to move file from {TempFile} to {TargetFile}", tempFile, target);