Saved views: a name in Greek, Cyrillic, Armenian, Georgian, Arabic or Ge'ez script is refused or overwrites another #504

Closed
opened 2026-10-01 10:47:09 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading how a saved view gets its slug and running it with the snapshot's interpreter.

Related to #259.

Checked again on 2026-10-01 against main at 0a5cad587: still present.

A saved view's slug comes from slugify(name), which without allow_unicode=True keeps only ASCII letters and digits. A name written in a non-Latin script gives an empty slug, and the view is refused with "A view needs a name." although one was typed. Postulo ships catalogues for el, bg, mk, sr, uk, ka, hy, am, ar and ti, whose speakers cannot name a view in their own script.

  • Where: core/tables.py:389-392, Table.save_view (slug = slugify(name)[:60], then if not name or not slug: return dict(current or {})); core/tables.py:214-217, View.from_stored, which falls back to the same slugify; core/views_tables.py:69-70, table_views, which reads "nothing changed" as "no name".
  • What happens: a person using the Greek interface saves a view as Αιτήσεις σε αναμονή. save_view returns the settings unchanged and the page says the view needs a name. Checked: CompaniesTable.save_view({}, "Αιτήσεις σε αναμονή", "q=x", []) returns {}; slugify gives "" for Заявки, ዝርዝር and طلبات.
  • Worse with a digit in the name: Заявки 2026 and Отказы 2026 both slug to 2026. Views are matched by slug, so saving the second silently replaces the first.
  • Why it matters: the feature is unusable in its own script for people using ten of the shipped languages, and quietly loses a view for anyone who adds a number.
  • Fix: use slugify(name, allow_unicode=True) in both save_view and View.from_stored. QueryDict.urlencode already percent-encodes a Unicode saved= value, and applied_view compares slugs as strings. A name made only of punctuation or emoji still gives an empty slug, so either refuse that with a message that says so, or use an opaque slug (a short hash of the cleaned name) that does not depend on the script.

Done when

  • tests/test_saved_views.py has tests that a Greek and a Cyrillic name each save a view that _views_of returns and view_url reaches, and that Заявки 2026 and Отказы 2026 are kept as two views.
Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading how a saved view gets its slug and running it with the snapshot's interpreter. Related to #259. Checked again on 2026-10-01 against `main` at `0a5cad587`: still present. A saved view's slug comes from `slugify(name)`, which without `allow_unicode=True` keeps only ASCII letters and digits. A name written in a non-Latin script gives an empty slug, and the view is refused with "A view needs a name." although one was typed. Postulo ships catalogues for el, bg, mk, sr, uk, ka, hy, am, ar and ti, whose speakers cannot name a view in their own script. - **Where:** `core/tables.py:389-392`, `Table.save_view` (`slug = slugify(name)[:60]`, then `if not name or not slug: return dict(current or {})`); `core/tables.py:214-217`, `View.from_stored`, which falls back to the same `slugify`; `core/views_tables.py:69-70`, `table_views`, which reads "nothing changed" as "no name". - **What happens:** a person using the Greek interface saves a view as *Αιτήσεις σε αναμονή*. `save_view` returns the settings unchanged and the page says the view needs a name. Checked: `CompaniesTable.save_view({}, "Αιτήσεις σε αναμονή", "q=x", [])` returns `{}`; `slugify` gives `""` for *Заявки*, *ዝርዝር* and *طلبات*. - **Worse with a digit in the name:** *Заявки 2026* and *Отказы 2026* both slug to `2026`. Views are matched by slug, so saving the second silently replaces the first. - **Why it matters:** the feature is unusable in its own script for people using ten of the shipped languages, and quietly loses a view for anyone who adds a number. - **Fix:** use `slugify(name, allow_unicode=True)` in both `save_view` and `View.from_stored`. `QueryDict.urlencode` already percent-encodes a Unicode `saved=` value, and `applied_view` compares slugs as strings. A name made only of punctuation or emoji still gives an empty slug, so either refuse that with a message that says so, or use an opaque slug (a short hash of the cleaned name) that does not depend on the script. ## Done when - `tests/test_saved_views.py` has tests that a Greek and a Cyrillic name each save a view that `_views_of` returns and `view_url` reaches, and that *Заявки 2026* and *Отказы 2026* are kept as two views.
tiagoagueda added this to the 0.5.0 milestone 2026-10-01 10:47:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#504
No description provided.