#617·owl

DocumentProcessingToolkit uses external unzip command, breaking zip extraction on Windows

Author: 007M7Created Jun 21, 2026Updated Jun 21, 2026

Summary

DocumentProcessingToolkit._unzip_file() shells out to the external unzip command. This is not available by default on Windows, so zip document processing can fail even though Python has a cross-platform zipfile module.

Reporter-assessed priority: P1 for Windows users who upload or process .zip files. Maintainers should adjust the priority as appropriate.

Environment

  • Repository: camel-ai/owl
  • Commit reviewed: 9dbcf271a889f04e23894cc928069617b4483815
  • Platform: Windows 10/11
  • File: owl/utils/document_toolkit.py

Evidence

owl/utils/document_toolkit.py:

python
subprocess.run(["unzip", "-o", zip_path, "-d", extract_path], check=True)

On Windows, unzip is not a built-in command. If the executable is missing, Python raises FileNotFoundError, which is not caught by the current except subprocess.CalledProcessError handler.

Steps to Reproduce

On Windows:

python
from owl.utils.document_toolkit import DocumentProcessingToolkit

toolkit = DocumentProcessingToolkit()
toolkit.extract_document_content("archive.zip")

The same path can also be triggered through the Web UI when a user uploads a .zip document.

Expected Behavior

Zip extraction should work cross-platform without requiring an external unzip binary.

Actual Behavior

On Windows, extraction can fail because unzip is not found:

FileNotFoundError: [WinError 2] The system cannot find the file specified

If unzip exists but fails, the current code wraps subprocess.CalledProcessError as:

RuntimeError: Failed to unzip file: ...

Suggested Fix

Use Python's built-in zipfile module instead of an external command:

python
import zipfile

with zipfile.ZipFile(zip_path, "r") as zip_file:
    zip_file.extractall(extract_path)

This removes the external command dependency and makes behavior consistent across Windows, macOS, and Linux.


中文补充

当前 .zip 文件处理依赖外部 unzip 命令,Windows 默认没有该命令。建议改用 Python 标准库 zipfile,这样可以避免 Windows 用户在文档上传 / 文档处理场景下遇到必现失败。