text icon indicating copy to clipboard operation
text copied to clipboard

Image Caching

Open Zehelein opened this issue 6 months ago • 2 comments

Is your feature request related to a problem? Please describe.

When switching between notes the images within the notes are downloaded again. The sessionId and sessionToken values in the image URLs change when switching notes. I understand that this is done for increased security and session hijacking. But I have notes with 50+ not-so-small images and opening such a note takes sometimes 30 seconds until I can really use the note. The image link itself works for some time even when a new sessionId was created.

Describe the solution you'd like

Ensure that the sessionId and sessionToken values stay the same, e.g. for 5 minutes.

Zehelein avatar Jun 19 '25 19:06 Zehelein

Thanks for reporting. I'll move this over to the text app as this is where the image URLs are generated and handled.

https://github.com/nextcloud/text/pull/7209 should help for your usability issue where the loading would block making reasonable use of your note i think, but would agree we should make the URLs cachable in some way.

juliusknorr avatar Jun 20 '25 06:06 juliusknorr

Given that browser-side HTTP caches use the exact URL as cache key, I see two ways forward here:

  1. Get rid of the ephemeral query parameters sessionId and sessionToken and think about other means to authenticate the session. Cookies or authentication headers come to my mind, but in general it doesn't feel like a good approach to change the session authentication just for attachments.
  2. Use a service worker and normalize the cache key used there to remove ephemeral query parameters.

Given that we're thinking about a service worker for Text anyway in order to pre-cache the app assets and improve offline capabilities, I would favour this solution.

mejo- avatar Oct 16 '25 13:10 mejo-