Conversation
Contributor
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
There was a problem hiding this comment.
Pull request overview
This PR improves WebDAV sync safety by ensuring a remote snapshot backup is created before uploading a new snapshot, and by restoring the previous remote snapshot if an upload fails.
Changes:
- Add a “backup error” sync result state/message and surface it via string resources.
- Introduce safe snapshot upload helpers (backup-before-upload + restore-on-failure) and parse helper for remote payload validation.
- Make WebDAV backup naming deterministic (
*.backup.json) and add unit tests for the new behaviors.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
app/src/main/java/net/micode/notes/sync/webdav/WebDavSyncManager.java |
Adds backup-safe upload/restore flow, backup error state, and parsing helpers. |
app/src/main/java/net/micode/notes/sync/webdav/WebDavClient.java |
Implements new transport interface and switches backup URL to deterministic naming. |
app/src/test/java/net/micode/notes/sync/webdav/WebDavSyncManagerTest.java |
Adds unit tests for safe upload, backup failure behavior, and snapshot parsing. |
app/src/test/java/net/micode/notes/sync/webdav/WebDavClientTest.java |
Updates tests for new deterministic backup URL behavior/signature. |
app/build.gradle |
Adds org.json dependency for JVM unit tests. |
res/values/strings.xml |
Adds backup error user-facing message (legacy packaged resources). |
res/values-zh-rTW/strings.xml |
Adds Traditional Chinese backup error translation (legacy packaged resources). |
res/values-zh-rCN/strings.xml |
Adds Simplified Chinese backup error translation (legacy packaged resources). |
app/src/main/values/strings.xml |
Adds backup error message in duplicate (currently unused) resource tree. |
app/src/main/values-zh-rTW/strings.xml |
Adds translation in duplicate (currently unused) resource tree. |
app/src/main/values-zh-rCN/strings.xml |
Adds translation in duplicate (currently unused) resource tree. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+383
to
392
| static void backupSnapshotSafely(SnapshotTransport client, String snapshot) | ||
| throws IOException { | ||
| if (!TextUtils.isEmpty(remotePayload)) { | ||
| client.putBackupSnapshot(remotePayload, System.currentTimeMillis()); | ||
| if (isEmpty(snapshot)) { | ||
| return; | ||
| } | ||
| try { | ||
| client.putBackupSnapshot(snapshot); | ||
| } catch (IOException e) { | ||
| throw new SnapshotBackupException(e); | ||
| } |
Comment on lines
114
to
+117
| <string name="sync_result_auth_error">WebDAV sync failed: check username and password</string> | ||
| <string name="sync_result_path_error">WebDAV sync failed: check WebDAV path and permissions</string> | ||
| <string name="sync_result_remote_not_found">WebDAV snapshot was not found. Sync once to create mi-notes-sync.json, or check the path.</string> | ||
| <string name="sync_result_backup_error">WebDAV sync failed: backup could not be created, so existing data was not changed</string> |
Comment on lines
109
to
+112
| <string name="sync_result_auth_error">WebDAV 同步失敗:請檢查使用者名稱和密碼</string> | ||
| <string name="sync_result_path_error">WebDAV 同步失敗:請檢查 WebDAV 路徑和權限</string> | ||
| <string name="sync_result_remote_not_found">未找到 WebDAV 快照。請同步一次以建立 mi-notes-sync.json,或檢查路徑。</string> | ||
| <string name="sync_result_backup_error">WebDAV 同步失敗:無法建立備份,現有資料未被變更</string> |
Comment on lines
110
to
+113
| <string name="sync_result_auth_error">WebDAV 同步失败:请检查用户名和密码</string> | ||
| <string name="sync_result_path_error">WebDAV 同步失败:请检查 WebDAV 路径和权限</string> | ||
| <string name="sync_result_remote_not_found">未找到 WebDAV 快照。请同步一次以创建 mi-notes-sync.json,或检查路径。</string> | ||
| <string name="sync_result_backup_error">WebDAV 同步失败:无法创建备份,现有数据未被更改</string> |
blrain3
added a commit
that referenced
this pull request
Jun 15, 2026
Enhance WebDAV snapshot backup safety
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.