Fix upload rollback and update app icon
Upload rollback fix: after uploading a file, do not store the remote mtime/etag from the upload response PROPFIND. Nextcloud and other WebDAV servers can change a file's Last-Modified or ETag after upload (thumbnail generation, checksums, folder aggregation). Storing stale metadata caused the next sync to see remoteChanged=true and download the file back, reverting the upload. Leaving remoteAfterTransfer=null forces the SKIP reconciliation pass to fill in remote state from the directory listing, which is the same source all future syncs use. Icon: update foreground to thick ribbons with 3D highlight stripes (blue/green/red/orange, width 12 + highlight 5); update background to dark space theme with star dots. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -107,11 +107,10 @@ class SyncEngine @Inject constructor(
|
||||
|
||||
when (decision) {
|
||||
SyncDecision.UPLOAD -> {
|
||||
var uploadedRemoteFile: RemoteFile? = null
|
||||
val bytes = runCatching {
|
||||
ensureRemoteDirs(provider, pair.remotePath, rel)
|
||||
accessor.openInputStream(rel)?.use { stream ->
|
||||
uploadedRemoteFile = provider.uploadFile(stream, "${pair.remotePath}/$rel", local!!.sizeBytes) { }.getOrThrow()
|
||||
provider.uploadFile(stream, "${pair.remotePath}/$rel", local!!.sizeBytes) { }.getOrThrow()
|
||||
}
|
||||
local!!.sizeBytes
|
||||
}.getOrElse { e ->
|
||||
@@ -120,8 +119,12 @@ class SyncEngine @Inject constructor(
|
||||
return@withPermit FileOutcome(failed = 1)
|
||||
}
|
||||
logEvent(pair.id, SyncEventType.FILE_UPLOADED, rel, null, bytes)
|
||||
// Don't store remote metadata from upload response — the server (Nextcloud etc.)
|
||||
// may change mtime/etag during post-upload processing. Leaving remoteModifiedAt
|
||||
// null forces the SKIP reconciliation on the next sync to fill it in from the
|
||||
// directory listing, which is the same source all future syncs will use.
|
||||
FileOutcome(uploaded = 1, bytesTransferred = bytes,
|
||||
newState = buildState(pair.id, rel, local!!, remoteAfterTransfer = uploadedRemoteFile))
|
||||
newState = buildState(pair.id, rel, local!!, remoteAfterTransfer = null))
|
||||
}
|
||||
SyncDecision.DOWNLOAD -> {
|
||||
val bytes = runCatching {
|
||||
|
||||
Reference in New Issue
Block a user