Repository navigation
fix(gallery): validate album rename and image_ids input (#6822) - #6823
Merged
alteixeira20 merged 1 commit intoOct 31, 2026
Merged
Conversation
dxrpl
force-pushed
the
fix/6822-gallery-album-input
branch
from
October 28, 2026 17:24
47949b9 to
29ee240
Compare
alteixeira20
approved these changes
Oct 31, 2026
alteixeira20
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Rejects non-string or blank names and descriptions on album rename and validates image_ids lists on add and remove. Regression tests pass on the PR head and integrated tree.
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.
Summary
PUT /api/gallery/albums/{id}storednameanddescriptionwithout checks, so a blank or whitespace name was accepted (create already rejects it), a number was stored as text, and a list or object made SQLAlchemy fail with a 500.POST .../addand.../removepassedimage_idsstraight toGalleryImage.id.in_(...), so anything but a list of ids (a string, number,null, objects, or a non-object body) was a 500. The update now requires a non-empty stringname(trimmed, same message as create) and a stringdescription; add/remove requireimage_idsto be a list of strings. Everything else answers 400. Valid requests behave as before.Target branch
labin the private maintainer-preview repository, ordevin the public repository.mainremains release-curated.Linked Issue
Fixes #6822
Type of Change
Checklist
labin maintainer-preview;devin the public repository)docker compose uporuvicorn app:app) and verified the change works end-to-end. Type-checks and unit tests are not enough.How to Test
I ran the branch natively (
uvicorn app:app, scratch data dir), logged in as admin and used curl.PUTwith{"name":" "},{"name":123},{"name":["x"]},{"description":{"a":1}}and a[1]body gave 400 (ondev: 200, 200, 500, 500, 500).PUTwith{"name":" Renamed ","description":"d"}gave 200 and the album list showedRenamed.addwith"abc"andnullasimage_idsgave 400 (500 ondev),[]and["x"]gave 200. I did not use the gallery UI or move real images into an album. The newtests/test_gallery_album_input.pyfails ondev(18 failures) and passes with the change.To check by hand:
POST /api/gallery/albumswith{"name":"Keep"}).curl -b cj -X PUT -H 'content-type: application/json' -d '{"name":" "}' localhost:7000/api/gallery/albums/<id>400 Album name required; ondevit returns{"ok":true}and the album ends up with a blank name.Visual / UI changes — REQUIRED if you touched anything that renders
No visual change: the edit only fixes variable scoping so the existing timeout message is reachable. No markup, CSS or styling was touched.
Screenshots / clips
The reply bubble after the 120 s timeout, with the fix applied: