Skip to content

fix: Bust full preview cache by etag - #3695

Open
hweihwang wants to merge 1 commit into
masterfrom
photos-viewer-preview-etag
Open

fix: Bust full preview cache by etag#3695
hweihwang wants to merge 1 commit into
masterfrom
photos-viewer-preview-etag

Conversation

@hweihwang

@hweihwang hweihwang commented Jul 27, 2026

Copy link
Copy Markdown

Problem: overwriting an image updates the grid thumbnail, but Viewer can retain the old full preview because its cacheable URL lacks the etag.

Change: add the sanitized WebDAV etag to authenticated and public-album full-preview URLs.

Generated assets: rebuilt with the production build.

Test: added a Vitest regression for the authenticated preview URL; production build and targeted ESLint passed.

History: this supersedes closed PR #3546.

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hweihwang
hweihwang requested a review from susnux August 3, 2026 09:03
@hweihwang

hweihwang commented Aug 3, 2026

Copy link
Copy Markdown
Author

Hi @susnux, CI is green now. Could you take another look when you have a chance? Thanks!

Comment thread src/utils/fileUtils.ts
@@ -139,6 +139,8 @@ export function toViewerFileInfo(file: Node): ViewerFileInfo {
source = getRemoteURL() + getRootPath() + filename
}

const decodedEtag = String(file.attributes.etag).replace(/&quot;/g, '')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really XML encoded?
Maybe make it a bit more resiliant:

Suggested change
const decodedEtag = String(file.attributes.etag).replace(/&quot;/g, '')
const decodedEtag = String(file.attributes.etag).replace(/(&quot;|")/g, '')

@@ -181,9 +181,11 @@ export default {
)

files.forEach((file) => {
const decodedEtag = String(file.attributes.etag).replace(/&quot;/g, '')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

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