fix(library): 자료실 루트 업로드 시 @library/ 태그 누락 수정

폴더 미선택 상태에서 업로드하면 doc_purpose='business'만 설정되고
@library/ 태그가 빠져서 자료실에 문서가 표시되지 않던 버그 수정.
백엔드: business 업로드에 library_path 없으면 @library/미분류 자동 태깅.
프론트: activePath 없을 때 기본값 '미분류' 전송.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-15 07:36:40 +09:00
parent e89e19f365
commit ef89d48bfe
3 changed files with 8 additions and 2 deletions
+5 -1
View File
@@ -402,7 +402,7 @@ async def upload_document(
library_path: str | None = Form(None, description="자료실 경로 (자동 @library/ 태깅)"),
):
"""파일 업로드 → Inbox 저장 + DB 등록 + 처리 큐 등록"""
from core.library import LIBRARY_PREFIX, normalize_library_path
from core.library import DEFAULT_LIBRARY_PATH, LIBRARY_PREFIX, normalize_library_path
# doc_purpose 검증
if doc_purpose is not None:
@@ -421,6 +421,10 @@ async def upload_document(
except ValueError as e:
raise HTTPException(status_code=400, detail=f"잘못된 자료실 경로: {e}")
# 자료실 업로드인데 경로 미지정 → 미분류 자동 태깅
if doc_purpose == "business" and not library_tag:
library_tag = f"{LIBRARY_PREFIX}{DEFAULT_LIBRARY_PATH}"
if not file.filename:
raise HTTPException(status_code=400, detail="파일명이 필요합니다")
+1
View File
@@ -4,6 +4,7 @@ user_tags 내 @library/ 접두사 태그를 정규화·검증·추출한다.
"""
LIBRARY_PREFIX = "@library/"
DEFAULT_LIBRARY_PATH = "미분류"
MAX_DEPTH = 5
MAX_SEGMENT_LEN = 30
+2 -1
View File
@@ -42,6 +42,7 @@
];
const ODF_FORMATS = ['ods', 'odt', 'odp', 'odoc', 'osheet'];
const DEFAULT_LIBRARY_PATH = '미분류';
// ─── 데이터 로드 ───
@@ -198,7 +199,7 @@
const formData = new FormData();
formData.append('file', file);
formData.append('doc_purpose', 'business');
if (activePath) formData.append('library_path', activePath);
formData.append('library_path', activePath || DEFAULT_LIBRARY_PATH);
try {
await api('/documents/', { method: 'POST', body: formData });
success++;