1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 17:13:06 +08:00

Fix truncating bug

This commit is contained in:
Cootz 2023-03-07 15:43:03 +03:00
parent 5191204569
commit 7107834b9e

View File

@ -58,6 +58,9 @@ namespace osu.Game.Database
{
string itemFilename = GetFilename(item).GetValidFilename();
if (itemFilename.Length > MAX_FILENAME_LENGTH - FileExtension.Length)
itemFilename = itemFilename.Remove(MAX_FILENAME_LENGTH - FileExtension.Length);
IEnumerable<string> existingExports =
exportStorage
.GetFiles(string.Empty, $"{itemFilename}*{FileExtension}")
@ -65,14 +68,6 @@ namespace osu.Game.Database
string filename = NamingUtils.GetNextBestFilename(existingExports, $"{itemFilename}{FileExtension}");
if (filename.Length > MAX_FILENAME_LENGTH)
{
string filenameWithoutExtension = Path.GetFileNameWithoutExtension(filename);
filenameWithoutExtension = filenameWithoutExtension.Remove(MAX_FILENAME_LENGTH - FileExtension.Length);
filename = $"{filenameWithoutExtension}{FileExtension}";
}
using (var stream = exportStorage.CreateFileSafely(filename))
ExportModelTo(item, stream);