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:
@@ -406,6 +406,7 @@ class DocumentMetadata:
|
|||||||
creator: Optional[str] = None
|
creator: Optional[str] = None
|
||||||
creation_date: Optional[datetime] = None
|
creation_date: Optional[datetime] = None
|
||||||
modification_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]:
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
"""Convert to dictionary for JSON serialization"""
|
"""Convert to dictionary for JSON serialization"""
|
||||||
@@ -421,7 +422,7 @@ class DocumentMetadata:
|
|||||||
# Add optional fields if present
|
# Add optional fields if present
|
||||||
optional_fields = [
|
optional_fields = [
|
||||||
"language", "title", "author", "subject",
|
"language", "title", "author", "subject",
|
||||||
"keywords", "producer", "creator"
|
"keywords", "producer", "creator", "original_filename"
|
||||||
]
|
]
|
||||||
for field in optional_fields:
|
for field in optional_fields:
|
||||||
value = getattr(self, field)
|
value = getattr(self, field)
|
||||||
|
|||||||
Reference in New Issue
Block a user