Skip to content

Commit 2112946

Browse files
committed
Fix: Don't calculate hashes
Update HashesViewModel.cs
1 parent 278bff9 commit 2112946

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,6 +2328,9 @@
23282328
<data name="CalculationError" xml:space="preserve">
23292329
<value>An error occurred during the calculation</value>
23302330
</data>
2331+
<data name="CalculationOnlineFileHashError" xml:space="preserve">
2332+
<value>Can't calculate hash for online file</value>
2333+
</data>
23312334
<data name="Algorithm" xml:space="preserve">
23322335
<value>Algorithm</value>
23332336
</data>

src/Files.App/ViewModels/Properties/HashesViewModel.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using CommunityToolkit.Mvvm.ComponentModel;
5-
using CommunityToolkit.Mvvm.DependencyInjection;
6-
using CommunityToolkit.Mvvm.Input;
7-
using CommunityToolkit.WinUI;
8-
using Files.App.Extensions;
9-
using Files.App.Utils;
10-
using Files.Shared.Extensions;
114
using Files.Shared.Helpers;
12-
using System;
13-
using System.Collections.Generic;
14-
using System.Collections.ObjectModel;
155
using System.IO;
16-
using System.Linq;
17-
using System.Threading;
186
using System.Windows.Input;
197

208
namespace Files.App.ViewModels.Properties
@@ -80,6 +68,13 @@ private void ToggleIsEnabled(string? algorithm)
8068
UserSettingsService.GeneralSettingsService.ShowHashesDictionary = ShowHashes;
8169
}
8270

71+
// Don't calculate hashes for online files
72+
if (_item.SyncStatusUI.SyncStatus == CloudDriveSyncStatus.FileOnline)
73+
{
74+
hashInfoItem.HashValue = "CalculationOnlineFileHashError".GetLocalizedResource();
75+
return;
76+
}
77+
8378
if (hashInfoItem.HashValue is null && hashInfoItem.IsEnabled)
8479
{
8580
hashInfoItem.IsCalculating = true;

0 commit comments

Comments
 (0)