From 5a411b8040a99a623d11be5ae134db7b17172714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 12 May 2026 04:43:15 +0200 Subject: [PATCH 01/16] Attempt to fix file type detection logic on Android (#6748) Intends to close https://github.com/ppy/osu/issues/37704 On Android, you can choose what file picker you like best. Some OEMs leverage this to implement their own (sometimes ad-ridden, *you know who you are*) file pickers. It appears that while some file pickers return content URIs that end with the actual underlying file's name, some file pickers return their specific gibberish, without a file extension in sight. And they are entitled to do so by the Android Decree of "you shall only ever interact with files via our magic APIs". But then game-side TagLib rolls up, sees a filename without an extension, goes "wots all dis den" and just rejects the file. So to keep the lie up, attempt a little harder to synthesise an actual usable file extension as if this was still a desktop computer with actual files. --- osu.Framework.Android/AndroidGameActivity.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Framework.Android/AndroidGameActivity.cs b/osu.Framework.Android/AndroidGameActivity.cs index 94b52d752f..d3a733f283 100644 --- a/osu.Framework.Android/AndroidGameActivity.cs +++ b/osu.Framework.Android/AndroidGameActivity.cs @@ -128,7 +128,7 @@ private void recycleTempContentDirectory() public FileInfo CreateTemporaryFileFromContentUri(Uri contentUri) { - // while content URIs are not real paths, in practice they appear to at least contain filenames at the end. + // while content URIs are not real paths, in practice they *appear* to at least *sometimes* contain real filenames at the end. // try using that first, since it's the least likely thing to fail later. // the reason why this is important is that downstream consumers may depend on the *extension* of the file in particular, // and there's no guarantee that we can recover it safely from anywhere else. @@ -136,8 +136,15 @@ public FileInfo CreateTemporaryFileFromContentUri(Uri contentUri) // if the content URI fails generate something else. if (string.IsNullOrEmpty(filename)) - { filename = Path.GetRandomFileName(); + + // check if we have an extension to use. + // there are two cases where we might not: + // - the content-providing app gave something resembling a filename but not an extension (known to happen in the wild) + // - there was no actual filename to use at any point, and we just generated our own above + // in both cases, attempt to synthesise an extension ourselves since there's nothing left to use anyway. + if (string.IsNullOrEmpty(Path.GetExtension(filename))) + { string? mimeType = ContentResolver?.GetType(contentUri); string? extension = MimeTypeMap.Singleton?.GetExtensionFromMimeType(mimeType); From ce76a4b76a3f6a97b426b098ddae3a882d363d53 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 12 May 2026 18:05:17 +0900 Subject: [PATCH 02/16] Bump SDL3 package --- osu.Framework/osu.Framework.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Framework/osu.Framework.csproj b/osu.Framework/osu.Framework.csproj index 985844dab7..2c6d1227fb 100644 --- a/osu.Framework/osu.Framework.csproj +++ b/osu.Framework/osu.Framework.csproj @@ -38,7 +38,7 @@ - +