Repository navigation
feat(api): create and change image blocks through the player API - #121
Merged
Merged
Conversation
POST documents/{id}/image-blocks uploads an image with its caption and
visibleTo in one call; PUT image-blocks/{id} changes caption and readers.
imageUrl is now a full link, while the app keeps its relative one.
App and API share IImageUploadService, which also checks the file's first
bytes: before, only the file name and the client's content type were checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
What changes
POST /api/external/v1/documents/{id}/image-blocksuploads an image asmultipart/form-datawithimage,visibleToand an optionalmarkdownText.PUT /api/external/v1/image-blocks/{id}changes the caption and readers; the image stays.imageUrlin the player API is now a full link, for existing image blocks too. The stored URL stays relative because the app prefixes its own base URL.IImageUploadService.Behaviour to review
/Image/streamimageuploadnow also rejects files whose first bytes are not PNG or JPEG. All 921 images currently stored on prod have matching signatures, so none of those would have been rejected.visibleTois a JSON array in a form field, e.g.visibleTo=["id"]or[]. Repeated form fields cannot express an explicit empty list, and the field must stay required so nothing is shared by accident.visibleTodoes not protect the image file./public/getimage/...works without login for anyone with the link. That is how app images already work; it is documented innotes.mdand not changed here.Testing
dotnet test RPGTableHelper.Backend.slnf -c Release: 500 passed, 1 skipped.visibleTo, non-image files, foreign documents, read-only keys, updates and deletes.X-Forwarded-Protois only simulated in a test, sohttpslinks behind the Cloudflare tunnel still need a real upload after deploy.No migration, no app change.
🤖 Generated with Claude Code