Storage: refactor readonly support (#52127)

This commit is contained in:
Ryan McKinley
2022-07-13 10:15:25 -07:00
committed by GitHub
parent 074bcf8599
commit ab6cf9e94d
5 changed files with 129 additions and 120 deletions
+4 -4
View File
@@ -74,15 +74,15 @@ func (s *standardStorageService) validateUploadRequest(ctx context.Context, user
}
switch req.EntityType {
case EntityTypeJSON:
fallthrough
case EntityTypeFolder:
fallthrough
case EntityTypeDashboard:
// TODO: add proper validation
var something interface{}
if err := json.Unmarshal(req.Contents, &something); err != nil {
return fail(err.Error())
if !json.Valid(req.Contents) {
return fail("invalid json")
}
return success()
case EntityTypeImage:
return s.validateImage(ctx, user, req)