[Bug]: Overwriting a file within the same second does not alter the etag
Nobody has claimed this yet.
- 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
- Login
- Upload one file
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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