1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 01:02:56 +08:00

Force a checksum check before skipping FileStore copy op

This commit is contained in:
Dean Herbert 2019-09-20 15:00:27 +09:00
parent c5474bc2ef
commit d0a4e1e3c2

View File

@ -50,7 +50,16 @@ namespace osu.Game.IO
string path = info.StoragePath;
// we may be re-adding a file to fix missing store entries.
if (!Storage.Exists(path))
bool requiresCopy = !Storage.Exists(path);
if (!requiresCopy)
{
// even if the file already exists, check the existing checksum for safety.
using (var stream = Storage.GetStream(path))
requiresCopy |= stream.ComputeSHA2Hash() != hash;
}
if (requiresCopy)
{
data.Seek(0, SeekOrigin.Begin);