fix: add original_filename field to DocumentMetadata

Add optional original_filename field to DocumentMetadata dataclass
to properly store the original filename when files are converted
(e.g., Office → PDF). This ensures the field is included in to_dict()
output for JSON serialization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-11-20 12:26:41 +08:00
parent ef335cf3af
commit 7064ea30d5

View File

@@ -406,6 +406,7 @@ class DocumentMetadata:
creator: Optional[str] = None
creation_date: Optional[datetime] = None
modification_date: Optional[datetime] = None
original_filename: Optional[str] = None # Original filename before conversion (e.g., Office → PDF)
def to_dict(self) -> Dict[str, Any]:
"""Convert to dictionary for JSON serialization"""
@@ -421,7 +422,7 @@ class DocumentMetadata:
# Add optional fields if present
optional_fields = [
"language", "title", "author", "subject",
"keywords", "producer", "creator"
"keywords", "producer", "creator", "original_filename"
]
for field in optional_fields:
value = getattr(self, field)