Skip to content

Commit f1cbffc

Browse files
committed
Added fix for hash file having a null hash for a file
1 parent cf283ee commit f1cbffc

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

FileVerification/CheckSumFile.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ public bool IsMatch(string file, HashAlgorithm hashAlgorithm)
247247
return false;
248248
}
249249

250+
if (string.IsNullOrWhiteSpace(hashInfo.Hash))
251+
{
252+
hashInfo.Hash = hash;
253+
}
254+
250255
return hashInfo.IsHashEqual(hash);
251256
}
252257
else

FileVerification/FileVerification.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
<AssemblyName>fv</AssemblyName>
77
<RootNamespace>TE.FileVerification</RootNamespace>
88
<Nullable>enable</Nullable>
9-
<FileVersion>1.2.0.0</FileVersion>
10-
<AssemblyVersion>1.2.0.0</AssemblyVersion>
11-
<Version>1.2.0</Version>
9+
<FileVersion>1.3.0.0</FileVersion>
10+
<AssemblyVersion>1.3.0.0</AssemblyVersion>
11+
<Version>1.3.0</Version>
1212
<AnalysisLevel>latest-all</AnalysisLevel>
13+
<Copyright>© 2024</Copyright>
1314
</PropertyGroup>
1415

1516
<ItemGroup>

FileVerification/HashInfo.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class HashInfo
3636
/// <summary>
3737
/// Gets the hash associated with the file.
3838
/// </summary>
39-
public string? Hash { get; private set; }
39+
public string? Hash { get; internal set; }
4040

4141
/// <summary>
4242
/// Gets the full path to the file.
@@ -95,11 +95,6 @@ private HashInfo(string filePath)
9595
public HashInfo(string filePath, string algorithm, string hash)
9696
: this(filePath)
9797
{
98-
if (hash == null || string.IsNullOrWhiteSpace(hash))
99-
{
100-
throw new ArgumentNullException(nameof(hash));
101-
}
102-
10398
Algorithm = GetAlgorithm(algorithm);
10499
Hash = hash;
105100
}

0 commit comments

Comments
 (0)