Skip to content

Commit 872fb38

Browse files
phernandezclaude
andcommitted
feat: Preserve file modification times during WebDAV upload
- Add X-OC-Mtime header to client upload requests - Send original file mtime as Unix timestamp - Enables accurate sync and preserves temporal context Part of #376 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6ed4886 commit 872fb38

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/basic_memory/cli/commands/cloud/upload.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,19 @@ async def upload_path(
8282
remote_path = f"/webdav/{project_name}/{relative_path}"
8383
print(f"Uploading {relative_path} ({i}/{len(files_to_upload)})")
8484

85+
# Get file modification time
86+
file_stat = file_path.stat()
87+
mtime = int(file_stat.st_mtime)
88+
8589
# Read file content asynchronously
8690
async with aiofiles.open(file_path, "rb") as f:
8791
content = await f.read()
8892

89-
# Upload via HTTP PUT to WebDAV endpoint
90-
response = await call_put(client, remote_path, content=content)
93+
# Upload via HTTP PUT to WebDAV endpoint with mtime header
94+
# Using X-OC-Mtime (ownCloud/Nextcloud standard)
95+
response = await call_put(
96+
client, remote_path, content=content, headers={"X-OC-Mtime": str(mtime)}
97+
)
9198
response.raise_for_status()
9299

93100
# Format total size based on magnitude

0 commit comments

Comments
 (0)