From 01fd18d550ad50c6f8eb0828ec3f208fccde2824 Mon Sep 17 00:00:00 2001 From: coolbot <76798835+coolbot100s@users.noreply.github.com> Date: Tue, 16 Jun 2026 11:51:45 -0700 Subject: [PATCH] Fix: update modpack export filter (#6359) * Update Modpack export filters * fix: move file export filtering from vue to rust * chore: remove unused import --------- Co-authored-by: Gravy Boat --- .../src/components/ui/ExportModal.vue | 9 +--- packages/app-lib/src/api/profile/mod.rs | 42 ++++++++++++++++--- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/apps/app-frontend/src/components/ui/ExportModal.vue b/apps/app-frontend/src/components/ui/ExportModal.vue index d856a9022..ea573dfef 100644 --- a/apps/app-frontend/src/components/ui/ExportModal.vue +++ b/apps/app-frontend/src/components/ui/ExportModal.vue @@ -89,14 +89,9 @@ const initFiles = async () => { disabled: folder === 'profile.json' || folder.startsWith('modrinth_logs') || - folder.startsWith('.fabric'), + folder.startsWith('.fabric') || + folder.startsWith('__MACOSX'), })) - .filter( - (pathData) => - !pathData.path.includes('.DS_Store') && - pathData.path !== 'mods/.connector' && - !pathData.path.startsWith('mods/.connector/'), - ) .forEach((pathData) => { const parent = pathData.path.split(sep).slice(0, -1).join(sep) if (parent !== '') { diff --git a/packages/app-lib/src/api/profile/mod.rs b/packages/app-lib/src/api/profile/mod.rs index 29e734f2f..a7f2f113a 100644 --- a/packages/app-lib/src/api/profile/mod.rs +++ b/packages/app-lib/src/api/profile/mod.rs @@ -667,7 +667,7 @@ pub async fn export_mrpack( } // File is not in the config file, add it to the .mrpack zip - if path.is_file() { + if path.is_file() && is_path_exportable(&relative_path) { let mut file = File::open(&path) .await .map_err(|e| IOError::with_path(e, &path))?; @@ -696,6 +696,30 @@ pub async fn export_mrpack( Ok(()) } +fn is_path_exportable(relative_path: &SafeRelativeUtf8UnixPathBuf) -> bool { + if relative_path.ends_with(".DS_Store") { + return false; + } + + if relative_path.starts_with("mods/.connector/") + || relative_path.starts_with(".sable/natives/") + || relative_path.starts_with("local/crash_assistant/") + || relative_path.starts_with("mods/mcef-libraries/") + || relative_path.starts_with("mods/mcef-cache/") + || relative_path.starts_with("config/super_resolution/libraries/") + || relative_path.starts_with("config/Veinminer/update/") + || relative_path.starts_with("config/epicfight/native/") + || relative_path.starts_with("essential/") + || relative_path.starts_with(".mixin.out/") + || relative_path.starts_with(".fabric/") + || relative_path.starts_with("__MACOSX/") + { + return false; + } + + true +} + // Given a folder path, populate a Vec of all the subfolders and files, at most 2 layers deep // profile // -- folder1 @@ -727,14 +751,20 @@ pub async fn get_pack_export_candidates( .await .map_err(|e| IOError::with_path(e, &profile_base_dir))? { - path_list.push(pack_get_relative_path( - &profile_base_dir, - &entry.path(), - )?); + let relative = + pack_get_relative_path(&profile_base_dir, &entry.path())?; + if !is_path_exportable(&relative) { + continue; + } + path_list.push(relative); } } else { // One layer of files/folders if its a file - path_list.push(pack_get_relative_path(&profile_base_dir, &path)?); + let relative = pack_get_relative_path(&profile_base_dir, &path)?; + if !is_path_exportable(&relative) { + continue; + } + path_list.push(relative); } } Ok(path_list)