From 4b32df50cb12f6c2fb02a8a9269c422d642878c4 Mon Sep 17 00:00:00 2001 From: zhangliang <16601301061@163.com> Date: Sat, 11 Oct 2025 00:42:03 +0800 Subject: [PATCH] bugfix: FileComponent fixes exception when uploading compressed files on mac (#7061) * bugfix: FileComponent fixes exception when uploading compressed files on mac * [autofix.ci] apply automated fixes * Change the way use the os package to use the imported Path() function --------- Co-authored-by: zhangliang1-jk Co-authored-by: Eric Hare Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/lfx/src/lfx/base/data/base_file.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lfx/src/lfx/base/data/base_file.py b/src/lfx/src/lfx/base/data/base_file.py index c56910f7f4..894289c874 100644 --- a/src/lfx/src/lfx/base/data/base_file.py +++ b/src/lfx/src/lfx/base/data/base_file.py @@ -672,6 +672,9 @@ class BaseFileComponent(Component, ABC): def _safe_extract_zip(bundle: ZipFile, output_dir: Path): """Safely extract ZIP files.""" for member in bundle.namelist(): + # Filter out resource fork information for automatic production of mac + if Path(member).name.startswith("._"): + continue member_path = output_dir / member # Ensure no path traversal outside `output_dir` if not member_path.resolve().is_relative_to(output_dir.resolve()): @@ -682,6 +685,9 @@ class BaseFileComponent(Component, ABC): def _safe_extract_tar(bundle: tarfile.TarFile, output_dir: Path): """Safely extract TAR files.""" for member in bundle.getmembers(): + # Filter out resource fork information for automatic production of mac + if Path(member.name).name.startswith("._"): + continue member_path = output_dir / member.name # Ensure no path traversal outside `output_dir` if not member_path.resolve().is_relative_to(output_dir.resolve()):