mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 00:42:55 +08:00
Fix truncating bug
This commit is contained in:
parent
5191204569
commit
7107834b9e
@ -58,6 +58,9 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
string itemFilename = GetFilename(item).GetValidFilename();
|
string itemFilename = GetFilename(item).GetValidFilename();
|
||||||
|
|
||||||
|
if (itemFilename.Length > MAX_FILENAME_LENGTH - FileExtension.Length)
|
||||||
|
itemFilename = itemFilename.Remove(MAX_FILENAME_LENGTH - FileExtension.Length);
|
||||||
|
|
||||||
IEnumerable<string> existingExports =
|
IEnumerable<string> existingExports =
|
||||||
exportStorage
|
exportStorage
|
||||||
.GetFiles(string.Empty, $"{itemFilename}*{FileExtension}")
|
.GetFiles(string.Empty, $"{itemFilename}*{FileExtension}")
|
||||||
@ -65,14 +68,6 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
string filename = NamingUtils.GetNextBestFilename(existingExports, $"{itemFilename}{FileExtension}");
|
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))
|
using (var stream = exportStorage.CreateFileSafely(filename))
|
||||||
ExportModelTo(item, stream);
|
ExportModelTo(item, stream);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user