Moving filesstore services into shared folder (#16940)
* Moving filesstore services into shared folder * Fixing app-layers generation * Renaming from filesstore to filestore
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5f9ab3783a
Коммит
78355ae2a7
4
Makefile
4
Makefile
@@ -270,9 +270,9 @@ migrations-bindata: ## Generates bindata migrations
|
||||
@echo Generating bindata for migrations
|
||||
$(GO) generate $(GOFLAGS) ./db/migrations/
|
||||
|
||||
filesstore-mocks: ## Creates mock files.
|
||||
filestore-mocks: ## Creates mock files.
|
||||
$(GO) get -modfile=go.tools.mod github.com/vektra/mockery/...
|
||||
$(GOBIN)/mockery -dir services/filesstore -all -output services/filesstore/mocks -note 'Regenerate this file using `make filesstore-mocks`.'
|
||||
$(GOBIN)/mockery -dir shared/filestore -all -output shared/filestore/mocks -note 'Regenerate this file using `make filestore-mocks`.'
|
||||
|
||||
ldap-mocks: ## Creates mock files for ldap.
|
||||
$(GO) get -modfile=go.tools.mod github.com/vektra/mockery/...
|
||||
|
||||
@@ -172,7 +172,7 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
filestoreStatusKey := "filestore_status"
|
||||
s[filestoreStatusKey] = model.STATUS_OK
|
||||
appErr := c.App.TestFilesStoreConnection()
|
||||
appErr := c.App.TestFileStoreConnection()
|
||||
if appErr != nil {
|
||||
s[filestoreStatusKey] = model.STATUS_UNHEALTHY
|
||||
s[model.STATUS] = model.STATUS_UNHEALTHY
|
||||
@@ -450,7 +450,7 @@ func testS3(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
cfg.FileSettings.AmazonS3SecretAccessKey = c.App.Config().FileSettings.AmazonS3SecretAccessKey
|
||||
}
|
||||
|
||||
appErr := c.App.TestFilesStoreConnectionWithConfig(&cfg.FileSettings)
|
||||
appErr := c.App.TestFileStoreConnectionWithConfig(&cfg.FileSettings)
|
||||
if appErr != nil {
|
||||
c.Err = appErr
|
||||
return
|
||||
|
||||
@@ -23,11 +23,11 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/plugin"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
"github.com/mattermost/mattermost-server/v5/services/httpservice"
|
||||
"github.com/mattermost/mattermost-server/v5/services/imageproxy"
|
||||
"github.com/mattermost/mattermost-server/v5/services/searchengine"
|
||||
"github.com/mattermost/mattermost-server/v5/services/timezones"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/i18n"
|
||||
"github.com/mattermost/mattermost-server/v5/store"
|
||||
)
|
||||
@@ -48,7 +48,7 @@ type AppIface interface {
|
||||
// AddPublicKey will add plugin public key to the config. Overwrites the previous file
|
||||
AddPublicKey(name string, key io.Reader) *model.AppError
|
||||
// Caller must close the first return value
|
||||
FileReader(path string) (filesstore.ReadCloseSeeker, *model.AppError)
|
||||
FileReader(path string) (filestore.ReadCloseSeeker, *model.AppError)
|
||||
// ChannelMembersMinusGroupMembers returns the set of users in the given channel minus the set of users in the given
|
||||
// groups.
|
||||
//
|
||||
@@ -312,7 +312,7 @@ type AppIface interface {
|
||||
DoAdvancedPermissionsMigration()
|
||||
// This function zip's up all the files in fileDatas array and then saves it to the directory specified with the specified zip file name
|
||||
// Ensure the zip file name ends with a .zip
|
||||
CreateZipFileAndAddFiles(fileBackend filesstore.FileBackend, fileDatas []model.FileData, zipFileName, directory string) error
|
||||
CreateZipFileAndAddFiles(fileBackend filestore.FileBackend, fileDatas []model.FileData, zipFileName, directory string) error
|
||||
// This to be used for places we check the users password when they are already logged in
|
||||
DoubleCheckPassword(user *model.User, password string) *model.AppError
|
||||
// UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
|
||||
@@ -502,7 +502,7 @@ type AppIface interface {
|
||||
EnvironmentConfig() map[string]interface{}
|
||||
ExportPermissions(w io.Writer) error
|
||||
FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError)
|
||||
FileBackend() (filesstore.FileBackend, *model.AppError)
|
||||
FileBackend() (filestore.FileBackend, *model.AppError)
|
||||
FileExists(path string) (bool, *model.AppError)
|
||||
FileModTime(path string) (time.Time, *model.AppError)
|
||||
FileSize(path string) (int64, *model.AppError)
|
||||
@@ -974,8 +974,8 @@ type AppIface interface {
|
||||
TelemetryId() string
|
||||
TestElasticsearch(cfg *model.Config) *model.AppError
|
||||
TestEmail(userID string, cfg *model.Config) *model.AppError
|
||||
TestFilesStoreConnection() *model.AppError
|
||||
TestFilesStoreConnectionWithConfig(cfg *model.FileSettings) *model.AppError
|
||||
TestFileStoreConnection() *model.AppError
|
||||
TestFileStoreConnectionWithConfig(cfg *model.FileSettings) *model.AppError
|
||||
TestLdap() *model.AppError
|
||||
TestSiteURL(siteURL string) *model.AppError
|
||||
Timezones() *timezones.Timezones
|
||||
|
||||
14
app/file.go
14
app/file.go
@@ -37,7 +37,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/plugin"
|
||||
"github.com/mattermost/mattermost-server/v5/services/docextractor"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
"github.com/mattermost/mattermost-server/v5/store"
|
||||
"github.com/mattermost/mattermost-server/v5/utils"
|
||||
)
|
||||
@@ -76,7 +76,7 @@ const (
|
||||
ImagePreviewPixelWidth = 1920
|
||||
)
|
||||
|
||||
func (a *App) FileBackend() (filesstore.FileBackend, *model.AppError) {
|
||||
func (a *App) FileBackend() (filestore.FileBackend, *model.AppError) {
|
||||
return a.Srv().FileBackend()
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ func (a *App) CheckMandatoryS3Fields(settings *model.FileSettings) *model.AppErr
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) TestFilesStoreConnection() *model.AppError {
|
||||
func (a *App) TestFileStoreConnection() *model.AppError {
|
||||
backend, err := a.FileBackend()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -101,9 +101,9 @@ func (a *App) TestFilesStoreConnection() *model.AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) TestFilesStoreConnectionWithConfig(cfg *model.FileSettings) *model.AppError {
|
||||
func (a *App) TestFileStoreConnectionWithConfig(cfg *model.FileSettings) *model.AppError {
|
||||
license := a.Srv().License()
|
||||
backend, err := filesstore.NewFileBackend(cfg.ToFileBackendSettings(license != nil && *license.Features.Compliance))
|
||||
backend, err := filestore.NewFileBackend(cfg.ToFileBackendSettings(license != nil && *license.Features.Compliance))
|
||||
if err != nil {
|
||||
return model.NewAppError("FileBackend", "api.file.no_driver.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
@@ -127,7 +127,7 @@ func (a *App) ReadFile(path string) ([]byte, *model.AppError) {
|
||||
}
|
||||
|
||||
// Caller must close the first return value
|
||||
func (a *App) FileReader(path string) (filesstore.ReadCloseSeeker, *model.AppError) {
|
||||
func (a *App) FileReader(path string) (filestore.ReadCloseSeeker, *model.AppError) {
|
||||
backend, err := a.FileBackend()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1310,7 +1310,7 @@ func (a *App) CopyFileInfos(userID string, fileIDs []string) ([]string, *model.A
|
||||
|
||||
// This function zip's up all the files in fileDatas array and then saves it to the directory specified with the specified zip file name
|
||||
// Ensure the zip file name ends with a .zip
|
||||
func (a *App) CreateZipFileAndAddFiles(fileBackend filesstore.FileBackend, fileDatas []model.FileData, zipFileName, directory string) error {
|
||||
func (a *App) CreateZipFileAndAddFiles(fileBackend filestore.FileBackend, fileDatas []model.FileData, zipFileName, directory string) error {
|
||||
// Create Zip File (temporarily stored on disk)
|
||||
conglomerateZipFile, err := os.Create(zipFileName)
|
||||
if err != nil {
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
filesStoreMocks "github.com/mattermost/mattermost-server/v5/services/filesstore/mocks"
|
||||
"github.com/mattermost/mattermost-server/v5/services/searchengine/mocks"
|
||||
filesStoreMocks "github.com/mattermost/mattermost-server/v5/shared/filestore/mocks"
|
||||
"github.com/mattermost/mattermost-server/v5/utils/fileutils"
|
||||
)
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/plugin"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
"github.com/mattermost/mattermost-server/v5/services/httpservice"
|
||||
"github.com/mattermost/mattermost-server/v5/services/imageproxy"
|
||||
"github.com/mattermost/mattermost-server/v5/services/searchengine"
|
||||
"github.com/mattermost/mattermost-server/v5/services/timezones"
|
||||
"github.com/mattermost/mattermost-server/v5/services/tracing"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/i18n"
|
||||
"github.com/mattermost/mattermost-server/v5/store"
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
@@ -2415,7 +2415,7 @@ func (a *OpenTracingAppLayer) CreateWebhookPost(userID string, channel *model.Ch
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) CreateZipFileAndAddFiles(fileBackend filesstore.FileBackend, fileDatas []model.FileData, zipFileName string, directory string) error {
|
||||
func (a *OpenTracingAppLayer) CreateZipFileAndAddFiles(fileBackend filestore.FileBackend, fileDatas []model.FileData, zipFileName string, directory string) error {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CreateZipFileAndAddFiles")
|
||||
|
||||
@@ -3688,7 +3688,7 @@ func (a *OpenTracingAppLayer) FetchSamlMetadataFromIdp(url string) ([]byte, *mod
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) FileBackend() (filesstore.FileBackend, *model.AppError) {
|
||||
func (a *OpenTracingAppLayer) FileBackend() (filestore.FileBackend, *model.AppError) {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.FileBackend")
|
||||
|
||||
@@ -3754,7 +3754,7 @@ func (a *OpenTracingAppLayer) FileModTime(path string) (time.Time, *model.AppErr
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) FileReader(path string) (filesstore.ReadCloseSeeker, *model.AppError) {
|
||||
func (a *OpenTracingAppLayer) FileReader(path string) (filestore.ReadCloseSeeker, *model.AppError) {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.FileReader")
|
||||
|
||||
@@ -14602,9 +14602,9 @@ func (a *OpenTracingAppLayer) TestEmail(userID string, cfg *model.Config) *model
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) TestFilesStoreConnection() *model.AppError {
|
||||
func (a *OpenTracingAppLayer) TestFileStoreConnection() *model.AppError {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.TestFilesStoreConnection")
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.TestFileStoreConnection")
|
||||
|
||||
a.ctx = newCtx
|
||||
a.app.Srv().Store.SetContext(newCtx)
|
||||
@@ -14614,7 +14614,7 @@ func (a *OpenTracingAppLayer) TestFilesStoreConnection() *model.AppError {
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
resultVar0 := a.app.TestFilesStoreConnection()
|
||||
resultVar0 := a.app.TestFileStoreConnection()
|
||||
|
||||
if resultVar0 != nil {
|
||||
span.LogFields(spanlog.Error(resultVar0))
|
||||
@@ -14624,9 +14624,9 @@ func (a *OpenTracingAppLayer) TestFilesStoreConnection() *model.AppError {
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) TestFilesStoreConnectionWithConfig(cfg *model.FileSettings) *model.AppError {
|
||||
func (a *OpenTracingAppLayer) TestFileStoreConnectionWithConfig(cfg *model.FileSettings) *model.AppError {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.TestFilesStoreConnectionWithConfig")
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.TestFileStoreConnectionWithConfig")
|
||||
|
||||
a.ctx = newCtx
|
||||
a.app.Srv().Store.SetContext(newCtx)
|
||||
@@ -14636,7 +14636,7 @@ func (a *OpenTracingAppLayer) TestFilesStoreConnectionWithConfig(cfg *model.File
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
resultVar0 := a.app.TestFilesStoreConnectionWithConfig(cfg)
|
||||
resultVar0 := a.app.TestFileStoreConnectionWithConfig(cfg)
|
||||
|
||||
if resultVar0 != nil {
|
||||
span.LogFields(spanlog.Error(resultVar0))
|
||||
|
||||
@@ -23,8 +23,8 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/plugin"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
"github.com/mattermost/mattermost-server/v5/services/marketplace"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
"github.com/mattermost/mattermost-server/v5/utils/fileutils"
|
||||
)
|
||||
|
||||
@@ -273,7 +273,7 @@ func (a *App) SyncPlugins() *model.AppError {
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
var signature filesstore.ReadCloseSeeker
|
||||
var signature filestore.ReadCloseSeeker
|
||||
if *a.Config().PluginSettings.RequirePluginSignature {
|
||||
signature, appErr = a.FileReader(plugin.signaturePath)
|
||||
if appErr != nil {
|
||||
|
||||
@@ -50,7 +50,7 @@ import (
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
"github.com/mattermost/mattermost-server/v5/utils"
|
||||
)
|
||||
|
||||
@@ -82,7 +82,7 @@ func (a *App) InstallPluginFromData(data model.PluginEventData) {
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
var signature filesstore.ReadCloseSeeker
|
||||
var signature filestore.ReadCloseSeeker
|
||||
if *a.Config().PluginSettings.RequirePluginSignature {
|
||||
signature, appErr = a.FileReader(plugin.signaturePath)
|
||||
if appErr != nil {
|
||||
|
||||
@@ -44,7 +44,6 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/plugin"
|
||||
"github.com/mattermost/mattermost-server/v5/services/awsmeter"
|
||||
"github.com/mattermost/mattermost-server/v5/services/cache"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
"github.com/mattermost/mattermost-server/v5/services/httpservice"
|
||||
"github.com/mattermost/mattermost-server/v5/services/imageproxy"
|
||||
"github.com/mattermost/mattermost-server/v5/services/mailservice"
|
||||
@@ -54,6 +53,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/services/timezones"
|
||||
"github.com/mattermost/mattermost-server/v5/services/tracing"
|
||||
"github.com/mattermost/mattermost-server/v5/services/upgrader"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/i18n"
|
||||
"github.com/mattermost/mattermost-server/v5/store"
|
||||
"github.com/mattermost/mattermost-server/v5/store/localcachelayer"
|
||||
@@ -1573,9 +1573,9 @@ func (s *Server) stopSearchEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) FileBackend() (filesstore.FileBackend, *model.AppError) {
|
||||
func (s *Server) FileBackend() (filestore.FileBackend, *model.AppError) {
|
||||
license := s.License()
|
||||
backend, err := filesstore.NewFileBackend(s.Config().FileSettings.ToFileBackendSettings(license != nil && *license.Features.Compliance))
|
||||
backend, err := filestore.NewFileBackend(s.Config().FileSettings.ToFileBackendSettings(license != nil && *license.Features.Compliance))
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("FileBackend", "api.file.no_driver.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/mattermost/ldap"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -1469,14 +1469,14 @@ func (s *FileSettings) SetDefaults(isUpdate bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *FileSettings) ToFileBackendSettings(enableComplianceFeature bool) filesstore.FileBackendSettings {
|
||||
func (s *FileSettings) ToFileBackendSettings(enableComplianceFeature bool) filestore.FileBackendSettings {
|
||||
if *s.DriverName == IMAGE_DRIVER_LOCAL {
|
||||
return filesstore.FileBackendSettings{
|
||||
return filestore.FileBackendSettings{
|
||||
DriverName: *s.DriverName,
|
||||
Directory: *s.Directory,
|
||||
}
|
||||
}
|
||||
return filesstore.FileBackendSettings{
|
||||
return filestore.FileBackendSettings{
|
||||
DriverName: *s.DriverName,
|
||||
AmazonS3AccessKeyId: *s.AmazonS3AccessKeyId,
|
||||
AmazonS3SecretAccessKey: *s.AmazonS3SecretAccessKey,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package filesstore
|
||||
package filestore
|
||||
|
||||
import (
|
||||
"io"
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package filesstore
|
||||
package filestore
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package filesstore
|
||||
package filestore
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -1,13 +1,13 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make filesstore-mocks`.
|
||||
// Regenerate this file using `make filestore-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
io "io"
|
||||
|
||||
filesstore "github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
filestore "github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
@@ -178,15 +178,15 @@ func (_m *FileBackend) ReadFile(path string) ([]byte, error) {
|
||||
}
|
||||
|
||||
// Reader provides a mock function with given fields: path
|
||||
func (_m *FileBackend) Reader(path string) (filesstore.ReadCloseSeeker, error) {
|
||||
func (_m *FileBackend) Reader(path string) (filestore.ReadCloseSeeker, error) {
|
||||
ret := _m.Called(path)
|
||||
|
||||
var r0 filesstore.ReadCloseSeeker
|
||||
if rf, ok := ret.Get(0).(func(string) filesstore.ReadCloseSeeker); ok {
|
||||
var r0 filestore.ReadCloseSeeker
|
||||
if rf, ok := ret.Get(0).(func(string) filestore.ReadCloseSeeker); ok {
|
||||
r0 = rf(path)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(filesstore.ReadCloseSeeker)
|
||||
r0 = ret.Get(0).(filestore.ReadCloseSeeker)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make filesstore-mocks`.
|
||||
// Regenerate this file using `make filestore-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package filesstore
|
||||
package filestore
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package filesstore
|
||||
package filestore
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -371,7 +371,7 @@ func (b *S3FileBackend) ListDirectory(path string) ([]string, error) {
|
||||
path = filepath.Join(b.pathPrefix, path)
|
||||
if !strings.HasSuffix(path, "/") && path != "" {
|
||||
// s3Clnt returns only the path itself when "/" is not present
|
||||
// appending "/" to make it consistent across all filesstores
|
||||
// appending "/" to make it consistent across all filestores
|
||||
path = path + "/"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package filesstore
|
||||
package filestore
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/filestore"
|
||||
"github.com/mattermost/mattermost-server/v5/utils"
|
||||
"github.com/mattermost/mattermost-server/v5/utils/fileutils"
|
||||
)
|
||||
@@ -119,7 +119,7 @@ func getTestResourcesToSetup() []testResourceDetails {
|
||||
}
|
||||
|
||||
func CopyFile(src, dst string) error {
|
||||
fileBackend, err := filesstore.NewFileBackend(filesstore.FileBackendSettings{DriverName: "local", Directory: ""})
|
||||
fileBackend, err := filestore.NewFileBackend(filestore.FileBackendSettings{DriverName: "local", Directory: ""})
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to copy file %s to %s", src, dst)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user