Skip to content

Commit 8d4437a

Browse files
moodyjmzclaude
andcommitted
fix: 🐛 handle negative lock timeout sentinel from files_lock
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>
1 parent f8fb1f2 commit 8d4437a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

app/src/main/java/com/nextcloud/ui/fileactions/FileActionsViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package com.nextcloud.ui.fileactions
99

1010
import android.os.Bundle
1111
import androidx.annotation.IdRes
12+
import androidx.annotation.VisibleForTesting
1213
import androidx.lifecycle.LiveData
1314
import androidx.lifecycle.MutableLiveData
1415
import androidx.lifecycle.ViewModel
@@ -125,7 +126,8 @@ class FileActionsViewModel @Inject constructor(
125126
}
126127
}
127128

128-
private fun getLockedUntil(file: OCFile): Long? = if (file.lockTimestamp == 0L || file.lockTimeout == 0L) {
129+
@VisibleForTesting
130+
internal fun getLockedUntil(file: OCFile): Long? = if (file.lockTimestamp == 0L || file.lockTimeout <= 0L) {
129131
null
130132
} else {
131133
(file.lockTimestamp + file.lockTimeout) * TimeConstants.MILLIS_PER_SECOND

0 commit comments

Comments
 (0)