Description
When users upload files from desktop clients to their workspaces, both the file and thumbnail are sent to the correct workspace bucket using the appropriate context. However, the web application always uses the personal storage context when downloading thumbnails, regardless of where they were actually stored. This causes thumbnails from workspace uploads to fail to display. The issue only appears with desktop uploads because when uploading directly from web, it uses the same incorrect personal context for both upload and download, so they accidentally match and work.
The file upload flow was corrected by adjusting how we determine whether a file belongs to a workspace or personal storage. Instead of using a hardcoded value, the upload context is now evaluated dynamically to retrieve the appropriate credentials from the environment. This ensures that when uploading a file to a workspace, both the file and its thumbnail are stored in the same workspace storage location, guaranteeing that files and their thumbnails always reside together in the correct storage space.
Additionally, backward compatibility was implemented for existing thumbnails that were previously stored in the wrong location. When downloading a thumbnail, the actual storage location is verified and the appropriate credentials are used to retrieve it. This means users with older thumbnails that were incorrectly stored in personal buckets can still view them seamlessly, while all new uploads follow the corrected behavior. This approach ensures a smooth transition without requiring migration of existing thumbnails or disrupting the user experience.
Related Issues
Related Pull Requests
Checklist
- Changes have been tested locally.
- Unit tests have been written or updated as necessary.
- The code adheres to the repository's coding standards.
- Relevant documentation has been added or updated.
- No new warnings or errors have been introduced.
- SonarCloud issues have been reviewed and addressed.
- QA Passed
Testing Process
- From the Windows desktop client, upload an image file to a workspace
- Open the web app and navigate to that workspace — the thumbnail should be visible in the file list without opening the file viewer
- From User A, upload an image to a workspace
- Log in as User B (with access to the same workspace) and navigate to it — the thumbnail should be visible in the file list without opening the file viewer
- For existing files uploaded before this fix, thumbnails stored in the personal bucket should still be visible