From da169dddb5b19e09833f3874d78a0305ed89cef1 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Mon, 11 Feb 2019 18:52:09 +0100 Subject: [PATCH 1/3] Remove DLL support and require all packages/plugins to be zip archives --- .../Updates/InstallationManager.cs | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 127b9c62ab..f03a594cde 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -529,20 +529,17 @@ namespace Emby.Server.Implementations.Updates private async Task PerformPackageInstallation(IProgress 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); - } + target = Path.Combine(_appPaths.PluginsPath, Path.GetFileNameWithoutExtension(package.targetFilename)); } // Download to temporary file so that, if interrupted, it won't destroy the existing installation @@ -561,17 +558,9 @@ 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 + using (var stream = File.OpenRead(tempFile)) { - Directory.CreateDirectory(Path.GetDirectoryName(target)); - File.Copy(tempFile, target, true); + _zipClient.ExtractAllFromZip(stream, target, true); } } catch (IOException ex) From 32992b614346c90543425135603662e5fcffce46 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Mon, 11 Feb 2019 18:53:35 +0100 Subject: [PATCH 2/3] Add extra linebreak --- Emby.Server.Implementations/Updates/InstallationManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index f03a594cde..adf609e20d 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -537,6 +537,7 @@ namespace Emby.Server.Implementations.Updates _logger.LogError("Only zip packages are supported. {Filename} is not a zip archive.", package.targetFilename); return; } + if (target == null) { target = Path.Combine(_appPaths.PluginsPath, Path.GetFileNameWithoutExtension(package.targetFilename)); From 406fb045c26ca7fcf653024e2cbb8a487c3774bf Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Mon, 11 Feb 2019 18:54:10 +0100 Subject: [PATCH 3/3] Change logging to match the action --- Emby.Server.Implementations/Updates/InstallationManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index adf609e20d..301802b8a6 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -566,7 +566,7 @@ namespace Emby.Server.Implementations.Updates } catch (IOException ex) { - _logger.LogError(ex, "Error attempting to move file from {TempFile} to {TargetFile}", tempFile, target); + _logger.LogError(ex, "Error attempting to extract {TempFile} to {TargetFile}", tempFile, target); throw; }