Checking for empty filter expression
This commit is contained in:
@@ -351,7 +351,7 @@ namespace Duplicati.Library.Utility
|
||||
/// <inheritdoc />
|
||||
public string GetFilterHash()
|
||||
{
|
||||
var hash = MD5HashHelper.GetHash(m_filters.Select(x => x.Filter));
|
||||
var hash = MD5HashHelper.GetHash(m_filters?.Select(x => x.Filter));
|
||||
return Utility.ByteArrayAsHexString(hash);
|
||||
}
|
||||
|
||||
@@ -587,9 +587,9 @@ namespace Duplicati.Library.Utility
|
||||
/// <param name="second">Second.</param>
|
||||
public static FilterExpression Combine(FilterExpression first, FilterExpression second)
|
||||
{
|
||||
if (first == null)
|
||||
if (first == null || first.Empty)
|
||||
return second;
|
||||
if (second == null)
|
||||
if (second == null || second.Empty)
|
||||
return first;
|
||||
|
||||
if (first.Result != second.Result)
|
||||
|
||||
@@ -50,10 +50,13 @@ namespace Duplicati.Library.Utility
|
||||
{
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
foreach (var str in inputStrings)
|
||||
if (inputStrings != null)
|
||||
{
|
||||
var inputBuffer = Encoding.UTF8.GetBytes(str);
|
||||
md5.TransformBlock(inputBuffer, 0, inputBuffer.Length, inputBuffer, 0);
|
||||
foreach (var str in inputStrings)
|
||||
{
|
||||
var inputBuffer = Encoding.UTF8.GetBytes(str);
|
||||
md5.TransformBlock(inputBuffer, 0, inputBuffer.Length, inputBuffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
md5.TransformFinalBlock(new byte[0], 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user