diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2019-02-12 09:02:27 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-12 09:02:27 -0500 |
| commit | 0ff38b6012af5a3d5d331067cbe9a9fba34d5eb8 (patch) | |
| tree | e3ca49cbf27fad1f6e388ad8d07c2c0c85677a0d | |
| parent | 8fd9f5b6a47ad7cce3d462a786cf6c4b215d22e1 (diff) | |
| parent | 406fb045c26ca7fcf653024e2cbb8a487c3774bf (diff) | |
Merge pull request #869 from cvium/only_zips
Remove DLL support and require all packages/plugins to be zip archives
| -rw-r--r-- | Emby.Server.Implementations/Updates/InstallationManager.cs | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 127b9c62a..301802b8a 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -529,20 +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); - } + 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,22 +559,14 @@ 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) { - _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; } |
