Skip to content

Thumbnails/avatars: PR 85 but with my changes#103

Open
guruz wants to merge 13 commits intomainfrom
pr_85_markus_v2
Open

Thumbnails/avatars: PR 85 but with my changes#103
guruz wants to merge 13 commits intomainfrom
pr_85_markus_v2

Conversation

@guruz
Copy link
Contributor

@guruz guruz commented Mar 3, 2026

Changes on top of PR #85:

  • Separate image loaders for thumbnails vs avatars — thumbnails use Coil disk cache with respectCacheHeaders(false) (content-addressed URLs, safe to cache forever); avatars use OkHttp HTTP cache with respectCacheHeaders(true) (identity-addressed URL, needs
    revalidation + offline fallback)
  • Remote ETag field — added remoteEtag to OCFile/OCFileEntity with DB migration, so thumbnail preview URLs always have a valid cache-buster even for non-downloaded files
  • Avatar retry on 401 — loadAvatarForAccount now retries once after a 5s delay if the initial load fails, to handle startup races where ConnectionValidator hasn't refreshed the token yet
  • Hamburger menu bottom sheet — restored missing filename and thumbnail that were lost in the Glide→Coil migration
  • Upload List avatar — fixed avatar not showing in the Uploads tab toolbar
  • Removed dead code — isFetchingAvatarAllowed() and its call site in SyncProfileOperation (avatar loading is now on-demand via Coil)
  • Multi-account avatar cache key — avatar URLs include ?u= to avoid cache collisions between accounts

@zerox80 Please have a look

zerox80 and others added 13 commits February 25, 2026 16:06
This commit acts as a squash of the thumbnail cache refactoring and avatar fixes.

See PR description for full details.
- Update FILE_PREVIEW_URI to use direct native /webdav path.
- Use Graph API explicitly for fetching Avatar image, dropping the /index.php/avatar hack & interceptor fallbacks.
TUS PATCH responses from openCloud do not include ETag headers.
This caused large file uploads (>10MB) to have null ETags in the
local database, breaking thumbnail preview URLs and caching.

Changes:
- TusUploadHelper: after TUS upload completes, perform a PROPFIND
  to fetch the file's ETag from the server
- PatchTusUploadChunkRemoteOperation: extract ETag from PATCH
  response header (for future backend support)
- UploadFileFromFileSystemWorker: persist ETag to database for both
  overwrite and non-overwrite uploads
- ThumbnailsRequester: use .orEmpty() for null-safe ETag formatting
Also fix avatar for multiple accounts on same server.
Before the etag was set to empty for non-downloaded files.
We need it for a proper cache key.
The avatar is assigned very early in the flow while refreshing the
access token did not pass yet leading to 401.
The cache does not help as it insists on a refresh.

This is probably a regression from switching from our own cache
to coil.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants