mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-26 00:28:17 +08:00
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 <zhangliang1-jk@360shuke.com> Co-authored-by: Eric Hare <ericrhare@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -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()):
|
||||
|
||||
Reference in New Issue
Block a user