From 0235fc136c977ba4166387594dbeff11a8e78b7c Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 26 Jul 2022 20:37:35 -0700 Subject: [PATCH] Storage: allow public access to public files (#52849) --- pkg/services/store/service.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/services/store/service.go b/pkg/services/store/service.go index f6a980d6854..c2f484a2129 100644 --- a/pkg/services/store/service.go +++ b/pkg/services/store/service.go @@ -143,6 +143,15 @@ func ProvideService(sql *sqlstore.SQLStore, features featuremgmt.FeatureToggles, } authService := newStaticStorageAuthService(func(ctx context.Context, user *models.SignedInUser, storageName string) map[string]filestorage.PathFilter { + // Public is OK to read regardless of user settings + if storageName == RootPublicStatic { + return map[string]filestorage.PathFilter{ + ActionFilesRead: allowAllPathFilter, + ActionFilesWrite: denyAllPathFilter, + ActionFilesDelete: denyAllPathFilter, + } + } + if user == nil { return nil } @@ -171,12 +180,6 @@ func ProvideService(sql *sqlstore.SQLStore, features featuremgmt.FeatureToggles, } switch storageName { - case RootPublicStatic: - return map[string]filestorage.PathFilter{ - ActionFilesRead: allowAllPathFilter, - ActionFilesWrite: denyAllPathFilter, - ActionFilesDelete: denyAllPathFilter, - } case RootDevenv: return map[string]filestorage.PathFilter{ ActionFilesRead: allowAllPathFilter,