fix(tkqc): 사진 silent data loss 차단 + 관리함 사진 보충 기능
근본 원인: 2026-04-01 보안 패치(f09c86e)에서 system3-api Dockerfile에
USER appuser 추가했으나, named volume(tkqc-package_uploads)이 root 소유로
남아있어 appuser(999)가 /app/uploads 에 쓰기 실패. 하지만 file_service.py
가 except → return None 으로 silent failure 처리해서 system2는 200 OK 로
인식. 결과: 4/1 이후 qc_issues.id=185~191 사진이 전부 photo_path=NULL.
조치:
1. system3 Dockerfile: entrypoint.sh 추가 → 시작 시 chown 후 gosu appuser 강등
(named volume 이 restart 후에도 root로 돌아가는 문제 영구 해결)
2. file_service.py: save_base64_image 실패 시 RuntimeError raise (silent 금지)
3. system2 workIssueController: sendToMProject 실패/예외 시 system 알림 발송
4. 관리함 (desktop + mobile): 이슈 상세/편집 모달에 원본 사진 보충 UI 추가
- 빈 슬롯(photo_path{N}=NULL)에만 자동 채움, 기존 사진 유지
- ManagementUpdateRequest 스키마에 photo/photo2~5 필드 추가
- update_issue_management 엔드포인트에 사진 저장 루프 추가
런타임 chown 으로 immediate data loss 는 이미 차단됨 (09:28 KST).
이 커밋은 재발 방지 + 데이터 복구 UI 제공.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -372,9 +372,30 @@ async def update_issue_management(
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=400, detail=f"완료 사진 저장 실패: {str(e)}")
|
||||
|
||||
# 나머지 필드 처리 (완료 사진 제외)
|
||||
# 원본(부적합) 사진 보충 처리 — 클라이언트가 빈 슬롯에만 채우도록 제어함
|
||||
# (2026-04-09: tkreport→tkqc 연동 중 유실된 사진 복구 용도로 추가)
|
||||
photo_fields = []
|
||||
for i in range(1, 6):
|
||||
photo_field = f"photo{i if i > 1 else ''}"
|
||||
path_field = f"photo_path{i if i > 1 else ''}"
|
||||
|
||||
if photo_field in update_data and update_data[photo_field]:
|
||||
photo_fields.append(photo_field)
|
||||
try:
|
||||
# 기존 사진이 있으면 교체 (클라이언트가 의도적으로 지정한 경우)
|
||||
existing_path = getattr(issue, path_field, None)
|
||||
if existing_path:
|
||||
delete_file(existing_path)
|
||||
|
||||
# 새 사진 저장 (prefix "image" — inbox/신규 생성과 동일)
|
||||
new_path = save_base64_image(update_data[photo_field], "image")
|
||||
setattr(issue, path_field, new_path)
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=400, detail=f"사진 저장 실패: {str(e)}")
|
||||
|
||||
# 나머지 필드 처리 (사진 필드 제외)
|
||||
for field, value in update_data.items():
|
||||
if field not in completion_photo_fields:
|
||||
if field not in completion_photo_fields and field not in photo_fields:
|
||||
try:
|
||||
setattr(issue, field, value)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user