fix: handle negative lock timeout (ETA_INFINITE sentinel) from files_lock#17069
Draft
moodyjmz wants to merge 2 commits into
Draft
fix: handle negative lock timeout (ETA_INFINITE sentinel) from files_lock#17069moodyjmz wants to merge 2 commits into
moodyjmz wants to merge 2 commits into
Conversation
When files_lock is configured with the default infinite timeout (-1 min), the server sends nc:lock-timeout=-60 via PROPFIND. The previous guard only checked for == 0, causing getLockedUntil() to compute a timestamp 60s in the past, making the lock appear expired immediately. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
Cover zero, negative (-60 sentinel), zero timestamp, and positive timeout cases for getLockedUntil(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
cc8bab1 to
d1c34f0
Compare
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
|
APK file: https://github.com/nextcloud/android/actions/runs/26125491810/artifacts/7098404610 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
files_lockis configured with infinite timeout (the default,-1minutes), it sendsnc:lock-timeout=-60via WebDAV PROPFINDgetLockedUntil()was computing(lockTimestamp + lockTimeout) * MILLIS_PER_SECONDwithout guarding against negative timeout values, resulting in a date in the pastThe guard was changed from
file.lockTimeout == 0Ltofile.lockTimeout <= 0Lso any non-positive timeout (including the-60sentinel) correctly returnsnull(no expiry shown).The root cause fix is server-side in
files_lock(see related PR). This is a defensive client-side guard for servers that haven't been updated yet.Test plan
FileActionsViewModelTest— 4 unit tests coveringlockTimeout == 0,lockTimeout < 0(-60sentinel),lockTimestamp == 0, and positive values🤖 Generated with Claude Code