Keep original filename when doc_type is auto instead of 'auto-{case}.ext'

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 12:52:18 +00:00
parent 561a4f7bcf
commit 40406b5fde

View File

@@ -672,7 +672,11 @@ async def api_upload_tagged_document(
if len(content) > MAX_FILE_SIZE:
raise HTTPException(400, f"קובץ גדול מדי. מקסימום: {MAX_FILE_SIZE // (1024*1024)}MB")
# Generate smart filename
# Generate smart filename — keep original name for auto classification
if doc_type == "auto":
safe_name = re.sub(r"[^\w\u0590-\u05FF\s.\-()]", "", Path(file.filename).stem).strip()
new_filename = f"{safe_name or 'document'}{ext}"
else:
new_filename = generate_doc_filename(doc_type, case_number, party_name, ext)
# Save to case directory