Skip to content

Commit be19246

Browse files
moodyjmzclaude
andcommitted
fix: 🐛 guard against negative nc:lock-timeout when computing lockTimeOut
When files_lock is configured with infinite timeout (-1 minutes), the server sends nc:lock-timeout=-60. Without the guard, lockTimeOut would be set to lockTime minus 60 seconds — a date in the past — causing clients to display the lock as already expired. Only compute lockTimeOut when the value is positive; leave it nil for infinite locks (zero or negative sentinel values). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
1 parent 4204ead commit be19246

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Sources/NextcloudKit/Models/NKDataFileXML.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public class NKDataFileXML: NSObject {
472472
if let lockTime = propstat["d:prop", "nc:lock-time"].int {
473473
file.lockTime = Date(timeIntervalSince1970: TimeInterval(lockTime))
474474
}
475-
if let lockTimeOut = propstat["d:prop", "nc:lock-timeout"].int {
475+
if let lockTimeOut = propstat["d:prop", "nc:lock-timeout"].int, lockTimeOut > 0 {
476476
file.lockTimeOut = file.lockTime?.addingTimeInterval(TimeInterval(lockTimeOut))
477477
}
478478

0 commit comments

Comments
 (0)