AOSSIE-Org / AOSSIE-Org/PictoPy

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

Aperta
#1,346 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
283
Fork
679
Merge medio
7g 2h
PR unite (30g)
3

Descrizione

### 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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.