AOSSIE-Org / AOSSIE-Org/PictoPy

BUG: Dead/inconsistent PRAGMA case_sensitive_like in get_db_connection (affects no queries today, latent footgun)

未关闭
#1,346 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
283
派生
679
平均合并
7 天 2 小时
30 天内合并 PR
3

描述

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

`backend/app/database/connection.py:23` sets `PRAGMA case_sensitive_like = ON` inside `get_db_connection()`. But that helper is only used in ~4 call sites (all in `albums.py`), and the **only `LIKE` query in the codebase** - `db_get_folder_ids_by_path_prefix` (`backend/app/database/folders.py:344`, `WHERE folder_path LIKE ? || '%'`) — uses a **raw `sqlite3.connect()`** that never runs the pragma.

So today the pragma changes the behaviour of **zero** queries (dead config). It becomes a latent footgun the moment any `LIKE` query is migrated onto `get_db_connection()`: subfolder prefix matching would silently turn case-sensitive and miss subfolders on case-insensitive filesystems (macOS/Windows).

**Fix:** remove the pragma (LIKE is case-insensitive by default), or - if case-sensitive LIKE is actually intended - apply it consistently and migrate the folder-prefix query onto the shared helper.

### Record

- [x] I agree to follow this project's Code of Conduct

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。