summaryrefslogtreecommitdiffstats
path: root/modules/storage/storage.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-10-16 04:51:06 +0100
committerGitHub <noreply@github.com>2020-10-15 23:51:06 -0400
commit91f2afdb546364195ff909186983b94a61ab3181 (patch)
tree3e3f38a31ca3206a5cf7efc799e7a8ac81a71db9 /modules/storage/storage.go
parentcb171dbd56e3889735115a04e4846f98ec364d65 (diff)
downloadgitea-91f2afdb546364195ff909186983b94a61ab3181.tar.gz
gitea-91f2afdb546364195ff909186983b94a61ab3181.zip
Prevent panics with missing storage (#13164)
* The `.Use` of storageHandler before setting up the template renderer causes a panic if there is an error to log. * The error passed to `ctx.Error` in that case may contain sensitive information and should not be rendered to the end user. We should instead log the error and render a simple error message. * There is no handling of missing avatars and this needs a 404. Minio errors need to be mapped to standard golang errors such as os.ErrNotExist. * There is no logging when storage is set up. Related #13159 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/storage/storage.go')
-rw-r--r--modules/storage/storage.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/storage/storage.go b/modules/storage/storage.go
index 1fa04119c7..45582f3915 100644
--- a/modules/storage/storage.go
+++ b/modules/storage/storage.go
@@ -12,6 +12,7 @@ import (
"net/url"
"os"
+ "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
)
@@ -141,21 +142,25 @@ 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)
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)
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)
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)
return
}