Renaming breaks file preview for internal links
Steps to reproduce
- Copy an internal link of a file (i.e. a PDF).
- Paste the link in a Talk message and send it.
- See how a preview of the file gets rendered below the link in the chat. When you click on the preview, the file opens.
- Rename the file in Nextcloud Files.
- Go back to the Talk chat and see how the file name in the preview is not updated and when you click on it, Talk shows an error "File does not exist anymore" and the file is not opened.
Expected behaviour
The file name in the preview gets updated on rename and the preview keeps working as a link to the file.
Actual behaviour
The file name in the preview is not updated and when you click on it, Talk shows an error "File does not exist anymore" and the file is not opened.
Talk app
Talk app version: 20.1.4
Custom Signaling server configured: yes, version 4e34e97f82dead32392b278c56229d47faecc728
Custom TURN server configured: yes
Custom STUN server configured: yes
Nextcloud version
30.0.6
Reproducible. Although one thing I noticed:
- My thought is that reference provider returns cached result: https://github.com/nextcloud/server/blob/86f3b81de7cc2d9db48d54120fae315d80ad3f75/core/Controller/ReferenceApiController.php#L110 from this response I see the correct internal link, but old filename
- If you share internal link, then rename a file, then share a file itself -> preview will be updated accordingly (cache reset)
@juliusknorr I see from initial commit it is cached for 1 hour?
Yes, in addition to the request caching in the browser there is also caching in the backend at https://github.com/nextcloud/server/blob/86f3b81de7cc2d9db48d54120fae315d80ad3f75/lib/private/Collaboration/Reference/ReferenceManager.php#L29 (also for 1 hour).
We have a way to invalidate at least the server side memory cache where we could also listen to a rename event https://github.com/nextcloud/server/blob/86f3b81de7cc2d9db48d54120fae315d80ad3f75/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php