Skip to content

Commit e6c8e36

Browse files
phernandezclaude
andauthored
fix: preserve mtime webdav upload 376 (#377)
Signed-off-by: Claude <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 449b62d commit e6c8e36

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)