nextcloud / nextcloud/server

[Bug]: Overwriting a file within the same second does not alter the etag

Open
#63,994 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 34-feedback bug feature: dav hotspot: file time handling
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
  • This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
  • This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
  • I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
  • I agree to follow Nextcloud's Code of Conduct.
  • I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description

I recently investigated test failures in text and it turned out they were due to etags not getting updated if the same file is written twice in the same second with different content. Salvatore investigated and found:

The etag update on the cache is skipped if the mtime did not change, and the precision for that is seconds (unix timestamp).

Steps to reproduce
  1. Login
  2. Upload one file
  3. Upload another file to the same location within the same second.

Originally found with https://github.com/nextcloud/text/blob/cb19d998ed8132e20da6c17085ed333bcd6b32a5/playwright/e2e/propfind.spec.ts#L25

I will add a playwright test that triggers this on server itself.

Expected behavior

Etag changes when the file is overwritten.

Nextcloud Server Info

Using https://github.com/nextcloud-libraries/nextcloud-e2e-test-server with the default setup. text and viewer app installed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Playwright reproduction in text's playwright/e2e/propfind.spec.ts around line 25, then trace the Nextcloud server cache etag update when a file's mtime has second-level precision. Add or run the server-side test described in the issue and verify that overwriting a file with different content within the same second changes its etag.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, playwright
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.