mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 22:23:32 +08:00
Fix temp files from beatmap listing imports not being cleaned up
As reported in #12718, it turns out that temporary files from beatmap set downloads performed via the beatmap listing overlay could remain in the user's filesystem even after the download has concluded. The reason for the issue is a failure in component integration. In the case of online downloads, files are first downloaded to a temporary directory (`C:/Temp` or `/tmp`), with a randomly generated filename, which ends in an extension of `.tmp`. On the other side, `ArchiveModelManager`s have a `ShouldDeleteArchive()` method, which determines whether a file should be deleted after importing. At the time of writing, in the case of beatmap imports the file is only automatically cleaned up if the extension of the file is equal to `.osz`, which was not the case for temporary files. As it turns out, `APIDownloadRequest` has a facility for adjusting the file's extension, via the protected `FileExtension` property. Therefore, use it in the case of `DownloadBeatmapSetRequest` to specify `.osz`, which then will make sure that the `ShouldDeleteArchive()` check in `BeatmapManager` picks it up for clean-up.
This commit is contained in:
parent
13bd3e95a9
commit
fe86ee629e
@ -23,6 +23,8 @@ namespace osu.Game.Online.API.Requests
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string FileExtension => ".osz";
|
||||
|
||||
protected override string Target => $@"beatmapsets/{Model.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user