Give empty archives a hash based on archive name to avoid dupli… (#7363)

Give empty archives a hash based on archive name to avoid duplicate imports
This commit is contained in:
Dean Herbert 2019-12-27 14:55:58 +09:00 committed by GitHub
commit df7714a3e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View File

@ -54,6 +54,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1225.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1227.0" />
</ItemGroup>
</Project>

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>

View File

@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.1225.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.1227.0" />
<PackageReference Include="Sentry" Version="1.2.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -74,7 +74,7 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1225.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1227.0" />
</ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies">
@ -82,7 +82,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2019.1225.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.1227.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />