mirror of
https://github.com/modrinth/code.git
synced 2026-09-04 05:48:57 +00:00
fix: NEVER_EXPORTABLE_PATH_SUFFIXES list
This commit is contained in:
@@ -46,6 +46,7 @@ const NEVER_EXPORTABLE_PATH_PREFIXES: &[&str] = &[
|
|||||||
".fabric",
|
".fabric",
|
||||||
"__MACOSX",
|
"__MACOSX",
|
||||||
];
|
];
|
||||||
|
const NEVER_EXPORTABLE_PATH_SUFFIXES: &[&str] = &[".DS_Store"];
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
@@ -272,16 +273,14 @@ pub async fn export_mrpack(
|
|||||||
fn is_path_exportable(relative_path: &SafeRelativeUtf8UnixPathBuf) -> bool {
|
fn is_path_exportable(relative_path: &SafeRelativeUtf8UnixPathBuf) -> bool {
|
||||||
let path = relative_path.as_str();
|
let path = relative_path.as_str();
|
||||||
|
|
||||||
if path.ends_with(".DS_Store") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
!NEVER_EXPORTABLE_PATH_PREFIXES.iter().any(|prefix| {
|
!NEVER_EXPORTABLE_PATH_PREFIXES.iter().any(|prefix| {
|
||||||
path == *prefix
|
path == *prefix
|
||||||
|| path
|
|| path
|
||||||
.strip_prefix(prefix)
|
.strip_prefix(prefix)
|
||||||
.is_some_and(|suffix| suffix.starts_with('/'))
|
.is_some_and(|suffix| suffix.starts_with('/'))
|
||||||
})
|
}) && !NEVER_EXPORTABLE_PATH_SUFFIXES
|
||||||
|
.iter()
|
||||||
|
.any(|suffix| path.ends_with(suffix))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument]
|
#[tracing::instrument]
|
||||||
|
|||||||
Reference in New Issue
Block a user