fix: URL-decode filenames in document synchronization to handle special characters

This commit is contained in:
bsiggel
2026-03-14 22:49:07 +00:00
parent c032e24d7a
commit 18f2ff775e
2 changed files with 8 additions and 1 deletions

View File

@@ -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}",