From ad140be6eb6bc89d3fbb602757bbc3755cceff42 Mon Sep 17 00:00:00 2001
From: Pascal Bleser
Date: Fri, 13 Nov 2026 19:01:53 +0100
Subject: [PATCH] fix(graph): name the space image size limit after space
images
The variable that sets a lower size limit for space images alone was
named after the service, GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE,
which reads like a limit for thumbnails in general. Rename it to
OC_SPACE_IMAGE_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE, and the yaml key
from thumbnails.max_input_image_file_size to
thumbnails.space_image_max_input_image_file_size.
The shared names OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE and
THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE are unchanged. Neither renamed
setting has been released yet.
Assisted-by: Claude Code:claude-opus-5-5
---
services/graph/README.md | 8 ++++----
services/graph/pkg/config/config.go | 2 +-
services/graph/pkg/config/defaults/defaultconfig.go | 2 +-
services/graph/pkg/config/parser/parse_test.go | 6 +++---
services/graph/pkg/service/v0/drives_space_image_test.go | 6 +++---
services/graph/pkg/service/v0/service.go | 4 ++--
tests/acceptance/features/apiSpaces/changeSpaces.feature | 2 +-
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/services/graph/README.md b/services/graph/README.md
index ea1876404b..73504349d6 100644
--- a/services/graph/README.md
+++ b/services/graph/README.md
@@ -108,14 +108,14 @@ Setting the limit there sets it for all three services:
OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE=100MB
```
-`GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE` sets a limit for space images alone. It only makes sense
-to set it lower than the limit of the thumbnail generator: a space image between the two would be
-accepted, but not shown.
+`OC_SPACE_IMAGE_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE` sets a limit for space images alone. It only
+makes sense to set it lower than the limit of the thumbnail generator: a space image between the two
+would be accepted, but not shown.
```bash
# thumbnails up to 100 MB, but space images only up to 10 MB
OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE=100MB
-GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE=10MB
+OC_SPACE_IMAGE_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE=10MB
```
Only the file size is checked. The thumbnail generator also has limits for the width and the height
diff --git a/services/graph/pkg/config/config.go b/services/graph/pkg/config/config.go
index 3de3b92bf0..02162f2d21 100644
--- a/services/graph/pkg/config/config.go
+++ b/services/graph/pkg/config/config.go
@@ -217,5 +217,5 @@ type Thumbnails struct {
AdditionalSourceTypes []string `yaml:"additional_source_types" env:"OC_THUMBNAILS_ADDITIONAL_SOURCE_TYPES;GRAPH_THUMBNAILS_ADDITIONAL_SOURCE_TYPES" desc:"Additional mime types a preview is announced for, the same list the webdav service attempts previews for. The types the build ships are included; this only adds to them." introductionVersion:"9.0.0"`
// read under the same names as by webdav and the thumbnails service, so that
// graph doesn't accept a space image no thumbnail can be made of
- MaxInputImageFileSize string `yaml:"max_input_image_file_size" env:"OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE;THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE;GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE" desc:"The maximum file size of an image that can be set as the image of a space. A larger one is refused with HTTP 413, because no thumbnail can be made of it, and space images are only shown as thumbnails. Usable common abbreviations: [KB, KiB, MB, MiB, GB, GiB], example: 50MB. An empty value means unlimited." introductionVersion:"%%NEXT%%"`
+ SpaceImageMaxInputImageFileSize string `yaml:"space_image_max_input_image_file_size" env:"OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE;THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE;OC_SPACE_IMAGE_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE" desc:"The maximum file size of an image that can be set as the image of a space. A larger one is refused with HTTP 413, because no thumbnail can be made of it, and space images are only shown as thumbnails. Usable common abbreviations: [KB, KiB, MB, MiB, GB, GiB], example: 50MB. An empty value means unlimited." introductionVersion:"%%NEXT%%"`
}
diff --git a/services/graph/pkg/config/defaults/defaultconfig.go b/services/graph/pkg/config/defaults/defaultconfig.go
index b98a6c9df9..56fe188b71 100644
--- a/services/graph/pkg/config/defaults/defaultconfig.go
+++ b/services/graph/pkg/config/defaults/defaultconfig.go
@@ -90,7 +90,7 @@ func DefaultConfig() *config.Config {
UsersCacheTTL: 60,
},
Thumbnails: config.Thumbnails{
- MaxInputImageFileSize: ocdefaults.ThumbnailsMaxInputImageFileSize,
+ SpaceImageMaxInputImageFileSize: ocdefaults.ThumbnailsMaxInputImageFileSize,
},
Identity: config.Identity{
Backend: "ldap",
diff --git a/services/graph/pkg/config/parser/parse_test.go b/services/graph/pkg/config/parser/parse_test.go
index 222df4be15..1b0ce2f063 100644
--- a/services/graph/pkg/config/parser/parse_test.go
+++ b/services/graph/pkg/config/parser/parse_test.go
@@ -43,7 +43,7 @@ var _ = Describe("the maximum size of a space image", func() {
generator := thumbnailsdefaults.DefaultConfig()
Expect(thumbnailsparser.ParseConfig(generator)).To(Succeed())
- Expect(cfg.Thumbnails.MaxInputImageFileSize).To(Equal(want))
+ Expect(cfg.Thumbnails.SpaceImageMaxInputImageFileSize).To(Equal(want))
Expect(generator.Thumbnail.MaxInputImageFileSize).To(Equal(want))
},
Entry("from the shared name", map[string]string{
@@ -60,9 +60,9 @@ var _ = Describe("the maximum size of a space image", func() {
It("can be set lower for graph alone", func() {
GinkgoT().Setenv("OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE", "100MB")
- GinkgoT().Setenv("GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE", "10MB")
+ GinkgoT().Setenv("OC_SPACE_IMAGE_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE", "10MB")
- Expect(decodeEnv().Thumbnails.MaxInputImageFileSize).To(Equal("10MB"))
+ Expect(decodeEnv().Thumbnails.SpaceImageMaxInputImageFileSize).To(Equal("10MB"))
})
})
diff --git a/services/graph/pkg/service/v0/drives_space_image_test.go b/services/graph/pkg/service/v0/drives_space_image_test.go
index efa66a181c..600cfb7499 100644
--- a/services/graph/pkg/service/v0/drives_space_image_test.go
+++ b/services/graph/pkg/service/v0/drives_space_image_test.go
@@ -63,7 +63,7 @@ var _ = Describe("setting the image of a space", func() {
// sets the maximum size of a space image, as the configuration does
setMaxSize := func(size string) {
- cfg.Thumbnails.MaxInputImageFileSize = size
+ cfg.Thumbnails.SpaceImageMaxInputImageFileSize = size
var err error
svc, err = newService()
Expect(err).ToNot(HaveOccurred())
@@ -207,8 +207,8 @@ var _ = Describe("setting the image of a space", func() {
)
It("doesn't start with a maximum size that isn't a size", func() {
- cfg.Thumbnails.MaxInputImageFileSize = "fifty megabytes"
+ cfg.Thumbnails.SpaceImageMaxInputImageFileSize = "fifty megabytes"
_, err := newService()
- Expect(err).To(MatchError(ContainSubstring("thumbnails.max_input_image_file_size")))
+ Expect(err).To(MatchError(ContainSubstring("thumbnails.space_image_max_input_image_file_size")))
})
})
diff --git a/services/graph/pkg/service/v0/service.go b/services/graph/pkg/service/v0/service.go
index bc54b87d18..52a9eed069 100644
--- a/services/graph/pkg/service/v0/service.go
+++ b/services/graph/pkg/service/v0/service.go
@@ -201,10 +201,10 @@ func NewService(opts ...Option) (Graph, error) { //nolint:maintidx
natskv: options.NatsKeyValue,
}
- if raw := strings.TrimSpace(options.Config.Thumbnails.MaxInputImageFileSize); raw != "" {
+ if raw := strings.TrimSpace(options.Config.Thumbnails.SpaceImageMaxInputImageFileSize); raw != "" {
size, err := bytesize.Parse(raw)
if err != nil {
- return svc, fmt.Errorf("invalid thumbnails.max_input_image_file_size %q: %w", raw, err)
+ return svc, fmt.Errorf("invalid thumbnails.space_image_max_input_image_file_size %q: %w", raw, err)
}
svc.maxSpaceImageSize = size.Bytes()
}
diff --git a/tests/acceptance/features/apiSpaces/changeSpaces.feature b/tests/acceptance/features/apiSpaces/changeSpaces.feature
index 2778890772..dcd3800132 100644
--- a/tests/acceptance/features/apiSpaces/changeSpaces.feature
+++ b/tests/acceptance/features/apiSpaces/changeSpaces.feature
@@ -374,7 +374,7 @@ Feature: Change data of space
@env-config
Scenario: user cannot set an image file larger than the maximum size as space image of the space via the Graph API
- Given the config "GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE" has been set to "10"
+ Given the config "OC_SPACE_IMAGE_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE" has been set to "10"
And user "Alice" has created a folder ".space" in space "Project Jupiter"
And user "Alice" has uploaded a file inside space "Project Jupiter" with content "nineteen bytes long" to ".space/spaceImage.jpg"
When user "Alice" sets the file ".space/spaceImage.jpg" as a space image in a special section of the "Project Jupiter" space