fix: URL-decode filenames in document synchronization to handle special characters
This commit is contained in:
@@ -10,6 +10,7 @@ Utility functions for document synchronization with xAI:
|
||||
|
||||
from typing import Dict, Any, Optional, List, Tuple
|
||||
from datetime import datetime, timedelta
|
||||
from urllib.parse import unquote
|
||||
|
||||
from services.sync_utils_base import BaseSyncUtils
|
||||
from services.models import FileStatus, XAISyncStatus
|
||||
@@ -365,6 +366,10 @@ class DocumentSync(BaseSyncUtils):
|
||||
# Filename: Nutze dokumentName/fileName falls vorhanden, sonst aus Attachment
|
||||
final_filename = filename or attachment.get('name', 'unknown')
|
||||
|
||||
# URL-decode filename (fixes special chars like §, ä, ö, ü, etc.)
|
||||
# EspoCRM stores filenames URL-encoded: %C2%A7 → §
|
||||
final_filename = unquote(final_filename)
|
||||
|
||||
return {
|
||||
'attachment_id': attachment_id,
|
||||
'download_url': f"/api/v1/Attachment/file/{attachment_id}",
|
||||
|
||||
Reference in New Issue
Block a user