mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:55:35 +08:00
Fix regression in file update logic (filename set too early)
This commit is contained in:
parent
a555407f37
commit
1c1c583d3b
@ -243,15 +243,15 @@ namespace osu.Game.Beatmaps
|
|||||||
var beatmapInfo = setInfo.Beatmaps.Single(b => b.ID == info.ID);
|
var beatmapInfo = setInfo.Beatmaps.Single(b => b.ID == info.ID);
|
||||||
var metadata = beatmapInfo.Metadata ?? setInfo.Metadata;
|
var metadata = beatmapInfo.Metadata ?? setInfo.Metadata;
|
||||||
|
|
||||||
|
// grab the original file (or create a new one if not found).
|
||||||
|
var fileInfo = setInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, beatmapInfo.Path, StringComparison.OrdinalIgnoreCase)) ?? new BeatmapSetFileInfo();
|
||||||
|
|
||||||
// metadata may have changed; update the path with the standard format.
|
// metadata may have changed; update the path with the standard format.
|
||||||
beatmapInfo.Path = $"{metadata.Artist} - {metadata.Title} ({metadata.Author}) [{beatmapInfo.Version}]";
|
beatmapInfo.Path = $"{metadata.Artist} - {metadata.Title} ({metadata.Author}) [{beatmapInfo.Version}]";
|
||||||
|
|
||||||
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
||||||
|
|
||||||
var fileInfo = setInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, beatmapInfo.Path, StringComparison.OrdinalIgnoreCase)) ?? new BeatmapSetFileInfo
|
// update existing or populate new file's filename.
|
||||||
{
|
fileInfo.Filename = beatmapInfo.Path;
|
||||||
Filename = beatmapInfo.Path
|
|
||||||
};
|
|
||||||
|
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
UpdateFile(setInfo, fileInfo, stream);
|
UpdateFile(setInfo, fileInfo, stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user