1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Give empty archives a hash based on archive name to avoid duplicate imports

This commit is contained in:
Dean Herbert 2019-12-26 18:44:31 +09:00
parent f005784070
commit 74d875a2e0

View File

@ -259,6 +259,9 @@ namespace osu.Game.Database
/// <summary>
/// Create a SHA-2 hash from the provided archive based on file content of all files matching <see cref="HashableFileTypes"/>.
/// </summary>
/// <remarks>
/// In the case of no matching files, a hash will be generated from the passed archive's <see cref="ArchiveReader.Name"/>.
/// </remarks>
private string computeHash(ArchiveReader reader)
{
// for now, concatenate all .osu files in the set to create a unique hash.
@ -270,7 +273,7 @@ namespace osu.Game.Database
s.CopyTo(hashable);
}
return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : null;
return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : reader.Name.ComputeSHA2Hash();
}
/// <summary>