From cca5cc63de451d5fe34f20beb2c5ee2f26e52b09 Mon Sep 17 00:00:00 2001 From: alexytomi <60690056+alexytomi@users.noreply.github.com> Date: Fri, 26 Dec 2025 21:03:25 +0800 Subject: [PATCH] fix: Fix mimetype issues with stock android not matching .mrpack We want to be able to grey out files that are not .zip or .mrpack so people can have an easier chance of seeing their modpacks. To do this, we match the `application/x-modrinth-modpack+zip` and `application/zip` mimetypes as prescribed in the Modrinth documentation https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack. Stock android does not have `application/x-modrinth-modpack+zip`. OEM vendors seem to include this in their ROMs, possibly from just using https://gitlab.freedesktop.org/xdg/shared-mime-info as part of where they source their additional mimetypes from. There's a tendency for Android 12 and below to not have the `application/x-modrinth-modpack+zip` mimetype, likely due to the addition of it being relatively recent, so we have to account for that by also adding `application/octet-stream`. We cannot only have `application/octet-stream` or else it fails to match .mrpack in systems that have `application/x-modrinth-modpack+zip`. Sadly there seems to be no reliable way to check whether or the the ROM has the `application/x-modrinth-modpack+zip` mimetype so we just match it along with `application/octet-stream` to cover our bases. --- .../contracts/OpenDocumentWithExtension.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/contracts/OpenDocumentWithExtension.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/contracts/OpenDocumentWithExtension.java index d761ebba0..8bd5e4547 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/contracts/OpenDocumentWithExtension.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/contracts/OpenDocumentWithExtension.java @@ -36,10 +36,24 @@ public class OpenDocumentWithExtension extends ActivityResultContract