BUG: Face search leaves temp files in a relative temp_uploads/ folder

オープン
#1,682 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@karthikeyakakarlapudi2007 がすでに取り組んでいます。

2026年11月5日 から。

  • #1698 @Hari20032005 による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
57/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

Start in backend/app/routes/face_clusters.py around face_tagging() and trace how the uploaded image reaches perform_face_search and how the finally block cleans it up. Check the existing user data directory and test layout before choosing an approach. Add coverage for cleanup after success and when face search raises; done when uploads do not remain in a relative temp_uploads/ folder and the cleanup test passes.

索引モデルが issue の本文から書いたものです。

説明

bug
Is there an existing issue for this?
  • I have searched the existing issues
What happened?

BUG: Face search leaves temp files in a relative temp_uploads/ folder

What happened?
When face search is called with a base64 image, face_tagging() in
backend/app/routes/face_clusters.py (around line 357) writes the upload to
a hardcoded relative folder:

temp_dir = "temp_uploads"
os.makedirs(temp_dir, exist_ok=True)

Problems:

  1. The path is relative to the process's working directory, so the folder
    appears wherever the backend was launched (e.g. the repo root or backend/
    in dev) and its location differs between dev and the packaged app.
  2. temp_uploads/ is not in .gitignore, so it can be accidentally committed.
  3. Cleanup happens in a finally block, but if the process is killed
    mid-request (app quit, crash) the uploaded image stays on disk. Nothing
    removes leftovers on the next start. For a privacy-first app, user
    photos lingering in an unmanaged folder is undesirable.

Found by reading the code; not yet reproduced at runtime.

Suggested fix

  • Use Python's tempfile (NamedTemporaryFile / mkstemp) or a subfolder of
    the existing user data dir instead of "temp_uploads".
  • If perform_face_search can accept bytes/an array, skip writing to disk.
  • Add a test covering that the temp file is removed after the request,
    including when face search raises.
Record
  • I agree to follow this project's Code of Conduct
主要言語
Python
スター
322
フォーク
793
平均マージ
6日 10時間
マージ済み PR(30日)
20

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AOSSIE-Org/PictoPy のほかの issue

AOSSIE-Org/PictoPy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。