MM-21103: change plugin signature path (#13360)
* MM-21103: change plugin signature path Save as `<plugin_id>.tar.gz.sig` instead of `<plugin_id>.sig`. The latter was a relic of the previous design to support multiple plugin signatures, but now creates an inconsistency with how the original source files were supplied as `<some_name>.tar.gz` and `<some_name>.tar.gz.sig`. Fixes: https://mattermost.atlassian.net/browse/MM-21103 * relax signature matches to avoid assuming signatures always exist
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7d499d2750
Коммит
89c0b61bc3
@@ -244,6 +244,7 @@ func (a *App) SyncPlugins() *model.AppError {
|
||||
if appErr != nil {
|
||||
return appErr
|
||||
}
|
||||
|
||||
for _, plugin := range pluginSignaturePathMap {
|
||||
reader, appErr := a.FileReader(plugin.path)
|
||||
if appErr != nil {
|
||||
@@ -593,6 +594,7 @@ func (a *App) getPluginsFromFolder() (map[string]*pluginSignaturePath, *model.Ap
|
||||
if appErr != nil {
|
||||
return nil, model.NewAppError("getPluginsFromDir", "app.plugin.sync.list_filestore.app_error", nil, appErr.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
pluginSignaturePathMap := make(map[string]*pluginSignaturePath)
|
||||
for _, path := range fileStorePaths {
|
||||
if strings.HasSuffix(path, ".tar.gz") {
|
||||
@@ -606,8 +608,8 @@ func (a *App) getPluginsFromFolder() (map[string]*pluginSignaturePath, *model.Ap
|
||||
}
|
||||
}
|
||||
for _, path := range fileStorePaths {
|
||||
if strings.HasSuffix(path, ".sig") {
|
||||
id := strings.TrimSuffix(filepath.Base(path), ".sig")
|
||||
if strings.HasSuffix(path, ".tar.gz.sig") {
|
||||
id := strings.TrimSuffix(filepath.Base(path), ".tar.gz.sig")
|
||||
if val, ok := pluginSignaturePathMap[id]; !ok {
|
||||
mlog.Error("Unknown signature", mlog.String("path", path))
|
||||
} else {
|
||||
@@ -615,5 +617,6 @@ func (a *App) getPluginsFromFolder() (map[string]*pluginSignaturePath, *model.Ap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pluginSignaturePathMap, nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user