From 2535be8a8175f4ad23120f1f1fb893c4a6837630 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 23 Jul 2020 16:26:16 -0400 Subject: [PATCH] forbid all unicode spaces in tag names --- lib/philomena/tags/tag.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/philomena/tags/tag.ex b/lib/philomena/tags/tag.ex index e1f5a026..7714f331 100644 --- a/lib/philomena/tags/tag.ex +++ b/lib/philomena/tags/tag.ex @@ -169,7 +169,7 @@ defmodule Philomena.Tags.Tag do # with ascii quotes, trim space from end name |> String.downcase() - |> String.replace(~r/[[:space:]|\x{200b}|\x{200c}|\x{200d}]+/u, " ") + |> String.replace(~r/[[:space:]\x{00a0}\x{1680}\x{180e}\x{2000}-\x{200b}\x{202f}\x{205f}\x{3000}\x{feff}]+/u, " ") |> String.replace(~r/[\x{00b4}\x{2018}\x{2019}\x{201a}\x{201b}\x{2032}]/u, "'") |> String.replace(~r/[\x{201c}\x{201d}\x{201e}\x{201f}\x{2033}]/u, "\"") |> String.trim()