Files: preview URLs keep stale thumbnails for up to a day after changes

オープン 初心者向け
#67,592 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, php
領域
frontend

調査の方向性

リンク先の行にある apps/files/src/composables/usePreviewImage.ts から始め、次に Core/Controller/PreviewController.php がプレビューのキャッシュヘッダーをどのように設定しているか確認してください。ETag がプレビュー URL のキャッシュバスターになる仕組みをたどり、該当するプレビューのテストを実行してください。ETag が短い間隔で更新された場合に URL が変わり、ブラウザーが更新されたサムネイルを取得するようになれば完了です。

索引モデルが issue の本文から書いたものです。

説明

1. to develop bug feature: files feature: previews and thumbnails
Bug description

The preview URL uses only the first 6 characters of the ETag (or of the mtime as fallback) as cache buster:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/apps/files/src/composables/usePreviewImage.ts#L74-L75

while previews are cached by the browser for 24 hours as immutable:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/core/Controller/PreviewController.php#L172

ETags generated with uniqid() (e.g. on object storage) only change their first 6 hex characters every 256 seconds, and the first 6 digits of a millisecond timestamp only every ~2.8 hours. So an image edited twice within a few minutes keeps showing the old thumbnail for up to a day. (The mtime fallback currently also throws, see #66919.)

Steps to reproduce

Found by code reading.

  1. With object storage as primary storage, upload an image and look at its thumbnail.
  2. Replace the image within a few minutes.
  3. The old thumbnail is still shown.
Expected behavior

The full ETag (or a hash of it) is used as cache buster.

Nextcloud version

master

主要言語
PHP
スター
37.7k
フォーク
5.4k
平均マージ
1日 23時間
マージ済み PR(30日)
585

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nextcloud/server のほかの issue

nextcloud/server の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。