Repository navigation
Description
Description
slugify throws away every character outside a-z0-9-:
.replace(/[^a-z0-9-]/g, '')Accented and non-ASCII letters are not transliterated, they are deleted. For a product whose brands are often Turkish, that hollows the name out rather than shortening it:
| Name | Slug produced |
|---|---|
Ürün |
rn |
Şeker |
eker |
Çiğdem |
idem |
Öz Güven |
z-gven |
Ağaç |
aa |
The same applies to German, French, Nordic and Slavic names — Müller becomes mller.
Nothing routes on the slug, so this breaks no navigation. Where it shows up is filenames: every CSV and PDF export is named ansvisor_${slug}_…, so a brand exports as ansvisor_rn_prompts_2026-08-21.csv. It also collides more eagerly than it should — Ağaç and Aa produce the same slug.
There are three copies of this logic, and they have already drifted apart in their fallbacks:
web/src/lib/actions/brand.ts— falls back tobrand-${Date.now()}web/src/lib/actions/organization.ts— falls back toorg-${Date.now()}onboarding/page.tsx— the same chain written inline, no shared function at all
Steps to reproduce
- Create a brand named
Ürün. - Look at its
slug, or export any CSV from one of its pages.
Expected behavior
The slug carries the name across: urun. Exports read ansvisor_urun_prompts_….csv.
Actual behavior
The slug is rn, and exports read ansvisor_rn_prompts_….csv.
Deployment mode
Cloud (ansvisor.com)
Environment
Not environment-specific.
Notes for whoever picks this up
Transliterate before stripping. The tidy way is Unicode normalization — normalize('NFD') splits a letter from its accent so the accent can be removed on its own, which handles é → e, ü → u and most of Latin-1 without a lookup table.
Two Turkish letters do not decompose and need an explicit mapping: ı and ş, plus ğ. Handle those before or alongside the normalization pass, and take care with I/ı — lowercasing Turkish is famously not the same as lowercasing English, so test Işık explicitly.
Please also pull the three copies into one shared helper while you are in there. Three implementations of the same rule is how they drifted in the first place; a single one with tests is the real fix. There is no test file for it today — a new one alongside web/src/lib/csv.test.ts is the pattern to follow.
Do not backfill existing rows. Slugs are stored, and rewriting them is a separate decision with its own consequences. This issue is about what new names produce.
Activity
shahzainshafique commentedon Aug 21, 2026
Hi @gkhngyk, I am picking up this issue.
gkhngyk commentedon Aug 21, 2026
@shahzainshafique it's yours — go ahead.
Two things from the issue worth repeating, since they are what makes this more than a one-line change:
brand.ts,organization.tsand the inline chain inonboarding/page.tsx, keeping each call site's existing fallback prefix (brand-,org-).ı,şandğexplicitly — they don't decompose under NFD — and testIşıkfor the Turkish lowercase case.No backfill of existing slugs.
fix(slug): transliterate non-ASCII letters instead of deleting them