From 849fe4e1bafe99fc336398f975a8d758f2693282 Mon Sep 17 00:00:00 2001 From: Corsican Frog <49497194+acorsicanfrog@users.noreply.github.com> Date: Tue, 5 May 2026 13:35:01 +0200 Subject: [PATCH 1/2] Hide dotfiles from instance content scanning Prevent hidden files such as .DS_Store from being treated as valid instance content. This updates the profile scanning logic in [packages/app-lib/src/state/profiles.rs](/Users/froggy/Downloads/code-main/packages/app-lib/src/state/profiles.rs#L420) to ignore basenames that start with '.', and applies that filter consistently in both scan paths. Signed-off-by: Corsican Frog <49497194+acorsicanfrog@users.noreply.github.com> --- packages/app-lib/src/state/profiles.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/app-lib/src/state/profiles.rs b/packages/app-lib/src/state/profiles.rs index 1ef3d28454..5c0fd432bb 100644 --- a/packages/app-lib/src/state/profiles.rs +++ b/packages/app-lib/src/state/profiles.rs @@ -417,6 +417,15 @@ struct InitialScanFile { cache_key: String, } +fn should_ignore_project_file( + project_type: ProjectType, + file_name: &str, +) -> bool { + file_name.starts_with('.') + || (project_type == ProjectType::ShaderPack + && file_name.ends_with(".txt")) +} + impl Profile { pub async fn get( path: &str, @@ -648,8 +657,10 @@ impl Profile { && let Some(file_name) = subdirectory .file_name() .and_then(|x| x.to_str()) - && !(project_type == ProjectType::ShaderPack - && file_name.ends_with(".txt")) + && !should_ignore_project_file( + project_type, + file_name, + ) { let file_size = subdirectory .metadata() @@ -1054,8 +1065,10 @@ impl Profile { if subdirectory.is_file() && let Some(file_name) = subdirectory.file_name().and_then(|x| x.to_str()) - && !(project_type == ProjectType::ShaderPack - && file_name.ends_with(".txt")) + && !should_ignore_project_file( + project_type, + file_name, + ) { let file_size = subdirectory .metadata() From abc6cf59d876eb37f086caf4d712d61c457cf977 Mon Sep 17 00:00:00 2001 From: Corsican Frog <49497194+acorsicanfrog@users.noreply.github.com> Date: Tue, 5 May 2026 20:56:54 +0200 Subject: [PATCH 2/2] Whitelist scannable instance content files Only scan supported content archives into instance content. Accept .jar files for mods and .zip files for datapacks, resourcepacks, and shaderpacks, after trimming the .disabled suffix. This prevents .DS_Store and other unsupported files from appearing in the Content tab. Signed-off-by: Corsican Frog <49497194+acorsicanfrog@users.noreply.github.com> --- packages/app-lib/src/state/profiles.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/app-lib/src/state/profiles.rs b/packages/app-lib/src/state/profiles.rs index 5c0fd432bb..f8cd9bf902 100644 --- a/packages/app-lib/src/state/profiles.rs +++ b/packages/app-lib/src/state/profiles.rs @@ -417,13 +417,23 @@ struct InitialScanFile { cache_key: String, } -fn should_ignore_project_file( +fn is_scannable_project_file( project_type: ProjectType, file_name: &str, ) -> bool { - file_name.starts_with('.') - || (project_type == ProjectType::ShaderPack - && file_name.ends_with(".txt")) + let Some(extension) = Path::new(file_name.trim_end_matches(".disabled")) + .extension() + .and_then(|ext| ext.to_str()) + else { + return false; + }; + + match project_type { + ProjectType::Mod => extension.eq_ignore_ascii_case("jar"), + ProjectType::DataPack + | ProjectType::ResourcePack + | ProjectType::ShaderPack => extension.eq_ignore_ascii_case("zip"), + } } impl Profile { @@ -657,7 +667,7 @@ impl Profile { && let Some(file_name) = subdirectory .file_name() .and_then(|x| x.to_str()) - && !should_ignore_project_file( + && is_scannable_project_file( project_type, file_name, ) @@ -1065,7 +1075,7 @@ impl Profile { if subdirectory.is_file() && let Some(file_name) = subdirectory.file_name().and_then(|x| x.to_str()) - && !should_ignore_project_file( + && is_scannable_project_file( project_type, file_name, )