Merge pull request #2109 from Bond-009/plugin

Fix plugin installation and correct api behaviour
This commit is contained in:
dkanada 2019-12-12 15:40:22 +09:00 committed by GitHub
commit 96a5dda9ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -141,8 +141,7 @@ namespace Emby.Server.Implementations.Updates
if (guid != Guid.Empty) if (guid != Guid.Empty)
{ {
var strGuid = guid.ToString("N", CultureInfo.InvariantCulture); availablePackages = availablePackages.Where(x => Guid.Parse(x.guid) == guid);
availablePackages = availablePackages.Where(x => x.guid.Equals(strGuid, StringComparison.OrdinalIgnoreCase));
} }
return availablePackages; return availablePackages;

View File

@ -136,10 +136,11 @@ namespace MediaBrowser.Api
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public object Get(GetPackage request) public object Get(GetPackage request)
{ {
var packages = _installationManager.GetAvailablePackages().Result; var packages = _installationManager.GetAvailablePackages().GetAwaiter().GetResult();
var result = _installationManager.FilterPackages(
var result = packages.FirstOrDefault(p => string.Equals(p.guid, request.AssemblyGuid ?? "none", StringComparison.OrdinalIgnoreCase)) packages,
?? packages.FirstOrDefault(p => p.name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); request.Name,
string.IsNullOrEmpty(request.AssemblyGuid) ? default : Guid.Parse(request.AssemblyGuid)).FirstOrDefault();
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
@ -184,7 +185,7 @@ namespace MediaBrowser.Api
var package = _installationManager.GetCompatibleVersions( var package = _installationManager.GetCompatibleVersions(
packages, packages,
request.Name, request.Name,
new Guid(request.AssemblyGuid), string.IsNullOrEmpty(request.AssemblyGuid) ? Guid.Empty : Guid.Parse(request.AssemblyGuid),
string.IsNullOrEmpty(request.Version) ? null : Version.Parse(request.Version), string.IsNullOrEmpty(request.Version) ? null : Version.Parse(request.Version),
request.UpdateClass).FirstOrDefault(); request.UpdateClass).FirstOrDefault();