Repository navigation
Fix double thumbnails/ path segment in thumbnail serving endpoint - #109
Merged
Merged
Conversation
Root Cause: - Database stores thumbnail path as 'thumbnails/123_filename_thumb.jpg' - Frontend calls '/thumbnails/thumbnails/123_filename_thumb.jpg' - Nginx proxy_pass strips '/thumbnails/' prefix - API received 'thumbnails/123_filename_thumb.jpg' - API constructed '/librarian-data/thumbnails/thumbnails/123_filename_thumb.jpg' - File not found because of double 'thumbnails/' segment Fix: - Strip leading 'thumbnails/' from path before constructing full path - This handles the nginx proxy_pass behavior correctly - Also maintains backward compatibility if path is already clean Affected Component: - api/app.py - get_thumbnail() endpoint Co-authored-by: openhands <openhands@all-hands.dev>
tamzrod
marked this pull request as ready for review
July 6, 2026 14:48
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
Fixes a critical bug where thumbnails fail to load due to double
thumbnails/path segment.Root Cause
The nginx
proxy_passbehavior was not accounted for in the API's path reconstruction:thumbnails/123_filename_thumb.jpg/thumbnails/thumbnails/123_filename_thumb.jpg/thumbnails/prefix → sendsthumbnails/123_filename_thumb.jpg/librarian-data/thumbnails/+thumbnails/123_filename_thumb.jpg/librarian-data/thumbnails/thumbnails/123_filename_thumb.jpg← DOUBLE SEGMENTFix
Added path normalization to strip leading
thumbnails/from the path before constructing the full filesystem path:Files Modified
api/app.py- Added 11 lines to normalize thumbnail pathVerification
thumbnails/123_thumb.jpg/librarian-data/thumbnails/123_thumb.jpg123_thumb.jpg/librarian-data/thumbnails/123_thumb.jpg../etc/passwd/etc/passwd(blocked)This PR was created by an AI agent (OpenHands) on behalf of the user.
@tamzrod can click here to continue refining the PR