mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(backend/copilot): catch openpyxl.InvalidFileException in bare ref parsing
InvalidFileException extends Exception directly (not ValueError/OSError), so it wasn't caught by the existing exception tuple. Corrupt .xlsx files would crash instead of raising FileRefExpansionError.
This commit is contained in:
@@ -43,6 +43,7 @@ from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
import yaml
|
||||
from openpyxl.utils.exceptions import InvalidFileException as OpenpyxlInvalidFile
|
||||
|
||||
from backend.copilot.context import (
|
||||
get_current_sandbox,
|
||||
@@ -469,6 +470,7 @@ async def _expand_bare_ref(
|
||||
KeyError,
|
||||
TypeError,
|
||||
zipfile.BadZipFile,
|
||||
OpenpyxlInvalidFile,
|
||||
) as exc:
|
||||
raise FileRefExpansionError(f"Failed to parse {fmt} file: {exc}") from exc
|
||||
# Normalize bytes fallback to str so tools never
|
||||
|
||||
Reference in New Issue
Block a user