From 1f539f076851f63de49f25d2d89c2205fb7653f6 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sat, 24 Oct 2020 20:54:59 +0100 Subject: [PATCH 1/3] Set the default type of the storage section The default STORAGE_TYPE should be the provided type. Fix #13286 Signed-off-by: Andrew Thornton --- modules/setting/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/setting/storage.go b/modules/setting/storage.go index ab0598ccf8d40..7883b628a8031 100644 --- a/modules/setting/storage.go +++ b/modules/setting/storage.go @@ -46,7 +46,7 @@ func getStorage(name, typ string, overrides ...*ini.Section) Storage { var storage Storage - storage.Type = sec.Key("STORAGE_TYPE").MustString("") + storage.Type = sec.Key("STORAGE_TYPE").MustString(typ) storage.ServeDirect = sec.Key("SERVE_DIRECT").MustBool(false) // Global Defaults From 4d2b7b51d323615fa6cfe2cc0d8f39eb1ab9994a Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sun, 25 Oct 2020 12:07:35 +0000 Subject: [PATCH 2/3] more fixes Signed-off-by: Andrew Thornton --- modules/setting/storage.go | 2 +- modules/storage/storage.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/setting/storage.go b/modules/setting/storage.go index 7883b628a8031..e743d6c20c512 100644 --- a/modules/setting/storage.go +++ b/modules/setting/storage.go @@ -21,7 +21,7 @@ type Storage struct { // MapTo implements the Mappable interface func (s *Storage) MapTo(v interface{}) error { - pathValue := reflect.ValueOf(v).FieldByName("Path") + pathValue := reflect.ValueOf(v).Elem().FieldByName("Path") if pathValue.IsValid() && pathValue.Kind() == reflect.String { pathValue.SetString(s.Path) } diff --git a/modules/storage/storage.go b/modules/storage/storage.go index 45582f3915c01..ec3a1c14a1a8e 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 } From 6a9c549cd990428867c9d66602984315f30815d2 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sun, 25 Oct 2020 16:41:09 +0000 Subject: [PATCH 3/3] an empty commit to kick drone