Repository navigation
fix(graph): refuse space images too large for a thumbnail - #3986
Open
pbleser-oc wants to merge 1 commit into
Open
pbleser-oc wants to merge 1 commit into
pbleser-oc wants to merge 1 commit into
Conversation
A space image is only ever shown as a thumbnail. When a file larger than the thumbnail generator accepts was set as the image of a space, the PATCH of the drive succeeded, but no thumbnail could be made of the file, so the space showed no image and nobody got an error. Before setting the image, graph now looks up the size of the file, and refuses a file above the limit with 413 Request Entity Too Large, without changing the space. The limit is the one of the thumbnail generator: graph reads it under the same names as the webdav and thumbnails services (OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE and the older THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE, 50MB by default, empty for unlimited), so one setting keeps the three in agreement. GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE sets a lower limit for space images alone. The default of 50MB is now one constant, which the graph, webdav and thumbnails services all use. Only the file size is checked: the dimension limits of the generator would need the whole image to be read. The space readme has no limit, and an empty image id is passed on unchecked, as before. Assisted-by: Claude Code:claude-opus-5-5
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 32 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Setting a file as the image of a space that is too large for the thumbnail generator succeeded, but the space then showed no image, since a space image is only ever shown as a thumbnail, and nobody got an error. Graph now refuses such a file with
413 Request Entity Too Large.Changes
PATCH /graph/v1.0/drives/{id}with animageinspeciallooks up the size of the file first, and refuses a file above the limit with 413, without changing the space. If the file can't be looked up, the request fails with that error (e.g. 404), also without changing the space.OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE, then the olderTHUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE, which still wins as it does in the other two. So one setting keeps the three in agreement.GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE(yamlthumbnails.max_input_image_file_size) sets a lower limit for space images alone. Default50MB, empty for unlimited, as for the other two services.50MBis one constant now,ThumbnailsMaxInputImageFileSizeinpkg/config/defaults, used by graph, webdav and thumbnails.ErrSpaceImageTooLarge.MIGRATION.mdsay that graph reads the setting too.Clients
A client that overwrites the file of the current space image with the new content, as the web UI does, has replaced that content already when graph refuses the new one, so the space shows no image in that case. The web UI also shows only a generic error for a 413. The follow-up for the web UI is opencloud-eu/web#4461.
Tests
drives_space_image_test.go): too large → 413 and nothing stored, exactly the limit, empty limit, the readme, an empty image id, lookup failures (404, 500), an invalid limit at startup.@env-configscenario inapiSpaces/changeSpaces.feature(413 for a file above the limit); the feature passes locally on posix.AI assistance: Claude Code (claude-opus-5-5) wrote the first draft of the code, the tests and the docs.