MM-21374 - Fixed extracting icon for prepackaged and local plugins (#13633)
* Merge upstream * Added extracting iconData for prepackaged and local plugins * Fixed tests * Removed report.xml Co-authored-by: Jason Paul Deland <9366595+jaydeland@users.noreply.github.com> Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
50e965510a
Коммит
ebfd332161
@@ -534,7 +534,9 @@ func (a *App) mergePrepackagedPlugins(remoteMarketplacePlugins map[string]*model
|
||||
|
||||
prepackagedMarketplace := &model.MarketplacePlugin{
|
||||
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
|
||||
Manifest: prepackaged.Manifest,
|
||||
HomepageURL: prepackaged.Manifest.HomepageURL,
|
||||
IconData: prepackaged.IconData,
|
||||
Manifest: prepackaged.Manifest,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -587,6 +589,14 @@ func (a *App) mergeLocalPlugins(remoteMarketplacePlugins map[string]*model.Marke
|
||||
continue
|
||||
}
|
||||
|
||||
iconData := ""
|
||||
if plugin.Manifest.IconPath != "" {
|
||||
iconData, err = getIcon(filepath.Join(plugin.Path, plugin.Manifest.IconPath))
|
||||
if err != nil {
|
||||
mlog.Warn("Error loading local plugin icon", mlog.String("plugin", plugin.Manifest.Id), mlog.String("icon_path", plugin.Manifest.IconPath), mlog.Err(err))
|
||||
}
|
||||
}
|
||||
|
||||
var labels []model.MarketplaceLabel
|
||||
if *a.Config().PluginSettings.EnableRemoteMarketplace {
|
||||
// Labels should not (yet) be localized as the labels sent by the Marketplace are not (yet) localizable.
|
||||
@@ -598,6 +608,7 @@ func (a *App) mergeLocalPlugins(remoteMarketplacePlugins map[string]*model.Marke
|
||||
|
||||
remoteMarketplacePlugins[plugin.Manifest.Id] = &model.MarketplacePlugin{
|
||||
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
|
||||
IconData: iconData,
|
||||
HomepageURL: plugin.Manifest.HomepageURL,
|
||||
Labels: labels,
|
||||
Manifest: plugin.Manifest,
|
||||
@@ -813,7 +824,7 @@ func getPrepackagedPlugin(pluginPath *pluginSignaturePath, pluginFile io.ReadSee
|
||||
}
|
||||
|
||||
if manifest.IconPath != "" {
|
||||
iconData, err := getIcon(manifest.IconPath)
|
||||
iconData, err := getIcon(filepath.Join(pluginDir, manifest.IconPath))
|
||||
if err != nil {
|
||||
return nil, "", errors.Wrapf(err, "Failed to read icon at %s", manifest.IconPath)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user