mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
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>
This commit is contained in:
@@ -82,12 +82,19 @@ async def upload_path(
|
||||
remote_path = f"/webdav/{project_name}/{relative_path}"
|
||||
print(f"Uploading {relative_path} ({i}/{len(files_to_upload)})")
|
||||
|
||||
# Get file modification time
|
||||
file_stat = file_path.stat()
|
||||
mtime = int(file_stat.st_mtime)
|
||||
|
||||
# Read file content asynchronously
|
||||
async with aiofiles.open(file_path, "rb") as f:
|
||||
content = await f.read()
|
||||
|
||||
# Upload via HTTP PUT to WebDAV endpoint
|
||||
response = await call_put(client, remote_path, content=content)
|
||||
# Upload via HTTP PUT to WebDAV endpoint with mtime header
|
||||
# Using X-OC-Mtime (ownCloud/Nextcloud standard)
|
||||
response = await call_put(
|
||||
client, remote_path, content=content, headers={"X-OC-Mtime": str(mtime)}
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
# Format total size based on magnitude
|
||||
|
||||
Reference in New Issue
Block a user