diff options
author | zeripath <art27@cantab.net> | 2020-10-25 17:19:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-25 17:19:06 +0000 |
commit | 172e7ee87f342d1681cc5c48bf69673849d128da (patch) | |
tree | 7a65a693e52584e7f04715f3dad006c82fe674c1 /modules/storage/storage.go | |
parent | e2740b32b5aa120b24e4e31119b515dd19dbd9c7 (diff) | |
download | gitea-172e7ee87f342d1681cc5c48bf69673849d128da.tar.gz gitea-172e7ee87f342d1681cc5c48bf69673849d128da.zip |
Fix Storage mapping (#13297)
This PR fixes several bugs in setting storage
* The default STORAGE_TYPE should be the provided type.
* The Storage config should be passed in to NewStorage as a pointer - otherwise the Mappable interface function MapTo will not be found
* There was a bug in the MapTo function.
Fix #13286
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/storage/storage.go')
-rw-r--r-- | modules/storage/storage.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/storage/storage.go b/modules/storage/storage.go index 45582f3915..ec3a1c14a1 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -143,24 +143,24 @@ func NewStorage(typStr string, cfg interface{}) (ObjectStorage, error) { func initAvatars() (err error) { log.Info("Initialising Avatar storage with type: %s", setting.Avatar.Storage.Type) - Avatars, err = NewStorage(setting.Avatar.Storage.Type, setting.Avatar.Storage) + Avatars, err = NewStorage(setting.Avatar.Storage.Type, &setting.Avatar.Storage) return } func initAttachments() (err error) { log.Info("Initialising Attachment storage with type: %s", setting.Attachment.Storage.Type) - Attachments, err = NewStorage(setting.Attachment.Storage.Type, setting.Attachment.Storage) + Attachments, err = NewStorage(setting.Attachment.Storage.Type, &setting.Attachment.Storage) return } func initLFS() (err error) { log.Info("Initialising LFS storage with type: %s", setting.LFS.Storage.Type) - LFS, err = NewStorage(setting.LFS.Storage.Type, setting.LFS.Storage) + LFS, err = NewStorage(setting.LFS.Storage.Type, &setting.LFS.Storage) return } func initRepoAvatars() (err error) { log.Info("Initialising Repository Avatar storage with type: %s", setting.RepoAvatar.Storage.Type) - RepoAvatars, err = NewStorage(setting.RepoAvatar.Storage.Type, setting.RepoAvatar.Storage) + RepoAvatars, err = NewStorage(setting.RepoAvatar.Storage.Type, &setting.RepoAvatar.Storage) return } |