From d9edb84523a503486fdc81157cef647e76250d0f Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Fri, 4 Aug 2023 11:24:53 -0300 Subject: [PATCH] Revert s3 path prefix normalization for plugins (#24184) This reverts 0af0a4eff45b133fb36496a73b839f55005aae02. During the [implementation](https://github.com/mattermost/mattermost/pull/15910) we [discussed](https://github.com/mattermost/mattermost/pull/15910#issuecomment-705925227) fixing the underlying issue. When we did [fix](https://github.com/mattermost/mattermost/pull/15949) the underlying issue, we didn't revert these changes. Revert it now to simplify the code. --- server/channels/app/plugin.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/server/channels/app/plugin.go b/server/channels/app/plugin.go index b1289f0dc9..64156ed64f 100644 --- a/server/channels/app/plugin.go +++ b/server/channels/app/plugin.go @@ -874,17 +874,7 @@ func (ch *Channels) getPluginsFromFolder() (map[string]*pluginSignaturePath, *mo func (ch *Channels) getPluginsFromFilePaths(fileStorePaths []string) map[string]*pluginSignaturePath { pluginSignaturePathMap := make(map[string]*pluginSignaturePath) - - fsPrefix := "" - if *ch.cfgSvc.Config().FileSettings.DriverName == model.ImageDriverS3 { - ptr := ch.cfgSvc.Config().FileSettings.AmazonS3PathPrefix - if ptr != nil && *ptr != "" { - fsPrefix = *ptr + "/" - } - } - for _, path := range fileStorePaths { - path = strings.TrimPrefix(path, fsPrefix) if strings.HasSuffix(path, ".tar.gz") { id := strings.TrimSuffix(filepath.Base(path), ".tar.gz") helper := &pluginSignaturePath{ @@ -896,7 +886,6 @@ func (ch *Channels) getPluginsFromFilePaths(fileStorePaths []string) map[string] } } for _, path := range fileStorePaths { - path = strings.TrimPrefix(path, fsPrefix) if strings.HasSuffix(path, ".tar.gz.sig") { id := strings.TrimSuffix(filepath.Base(path), ".tar.gz.sig") if val, ok := pluginSignaturePathMap[id]; !ok {