ginipick commited on
Commit
b7b41db
Β·
verified Β·
1 Parent(s): 443aad8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -405,7 +405,8 @@ async def get_pdf_content(path: str, background_tasks: BackgroundTasks):
405
  logger.error(f"PDF μ½˜ν…μΈ  λ‘œλ“œ 였λ₯˜: {str(e)}\n{error_details}")
406
  return JSONResponse(content={"error": str(e)}, status_code=500)
407
 
408
- # PDF μ—…λ‘œλ“œ μ—”λ“œν¬μΈνŠΈ - 영ꡬ μ €μž₯μ†Œμ— μ €μž₯
 
409
  @app.post("/api/upload-pdf")
410
  async def upload_pdf(file: UploadFile = File(...)):
411
  try:
@@ -424,9 +425,9 @@ async def upload_pdf(file: UploadFile = File(...)):
424
  with open(file_path, "wb") as buffer:
425
  buffer.write(content)
426
 
427
- # 메인 디렉토리에도 볡사 (ν•„μš”μ‹œ 선택 κ°€λŠ₯, κ΄€λ¦¬μžκ°€ μ„ νƒν•œ PDF만 ν‘œμ‹œ)
428
- # with open(PDF_DIR / file.filename, "wb") as buffer:
429
- # buffer.write(content)
430
 
431
  # λ°±κ·ΈλΌμš΄λ“œμ—μ„œ 캐싱 μ‹œμž‘
432
  asyncio.create_task(cache_pdf(str(file_path)))
@@ -444,6 +445,7 @@ async def upload_pdf(file: UploadFile = File(...)):
444
  status_code=500
445
  )
446
 
 
447
  # κ΄€λ¦¬μž 인증 μ—”λ“œν¬μΈνŠΈ
448
  @app.post("/api/admin-login")
449
  async def admin_login(password: str = Form(...)):
 
405
  logger.error(f"PDF μ½˜ν…μΈ  λ‘œλ“œ 였λ₯˜: {str(e)}\n{error_details}")
406
  return JSONResponse(content={"error": str(e)}, status_code=500)
407
 
408
+
409
+ # PDF μ—…λ‘œλ“œ μ—”λ“œν¬μΈνŠΈ - 영ꡬ μ €μž₯μ†Œμ— μ €μž₯ 및 메인 화면에 μžλ™ ν‘œμ‹œ
410
  @app.post("/api/upload-pdf")
411
  async def upload_pdf(file: UploadFile = File(...)):
412
  try:
 
425
  with open(file_path, "wb") as buffer:
426
  buffer.write(content)
427
 
428
+ # 메인 디렉토리에도 μžλ™μœΌλ‘œ 볡사 (μžλ™ ν‘œμ‹œ)
429
+ with open(PDF_DIR / file.filename, "wb") as buffer:
430
+ buffer.write(content)
431
 
432
  # λ°±κ·ΈλΌμš΄λ“œμ—μ„œ 캐싱 μ‹œμž‘
433
  asyncio.create_task(cache_pdf(str(file_path)))
 
445
  status_code=500
446
  )
447
 
448
+
449
  # κ΄€λ¦¬μž 인증 μ—”λ“œν¬μΈνŠΈ
450
  @app.post("/api/admin-login")
451
  async def admin_login(password: str = Form(...)):