Skip to content

Commit

Permalink
修复无法连接到webdav时重复报同步失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
1 committed Sep 15, 2021
1 parent 25cee52 commit 327e6b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions SyncClipboard/Service/SyncService/DownloadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ private async Task PullLoop()

private async Task SetRemoteProfileToLocal(Profile remoteProfile)
{
if (remoteProfile is null)
{
return;
}
Profile localProfile = ProfileFactory.CreateFromLocal();
if (localProfile.GetProfileType() == ProfileType.ClipboardType.Unknown)
{
Expand Down
5 changes: 5 additions & 0 deletions SyncClipboard/Service/SyncService/Profile/ProfileFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ private static LocalClipboard GetLocalClipboard()
public static async Task<Profile> CreateFromRemote(IWebDav webDav)
{
string httpReply = await webDav.GetTextAsync(SyncService.REMOTE_RECORD_FILE, 0, 0).ConfigureAwait(false);

if (string.IsNullOrWhiteSpace(httpReply))
{
return null;
}
Log.Write("[PULL] json " + httpReply);

JsonProfile jsonProfile;
Expand Down
5 changes: 4 additions & 1 deletion SyncClipboard/Service/SyncService/UploadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ public void PullStoppedHandler()

private void ClipBoardChangedHandler()
{
if (!UserConfig.Config.SyncService.PushSwitchOn || _isChangingLocal)
if (string.IsNullOrWhiteSpace(UserConfig.Config.SyncService.RemoteURL) ||
string.IsNullOrWhiteSpace(UserConfig.Config.SyncService.UserName) ||
string.IsNullOrWhiteSpace(UserConfig.Config.SyncService.Password) ||
!UserConfig.Config.SyncService.PushSwitchOn || _isChangingLocal)
{
return;
}
Expand Down

0 comments on commit 327e6b0

Please sign in to comment.