From 10ce44c2971f65c5fa732d91a74e3fa61d43c3bd Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 2 Aug 2011 13:49:00 -0400 Subject: [PATCH] cleanse tags of non-tag characters when canonicalizing --- lib/util.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index e5b0c86e06..d8eee3d134 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1096,8 +1096,11 @@ function common_tag_link($tag) function common_canonical_tag($tag) { + // only alphanum + $tag = preg_replace('/[^\pL\pN]/', '', $tag); $tag = mb_convert_case($tag, MB_CASE_LOWER, "UTF-8"); - return str_replace(array('-', '_', '.'), '', $tag); + $tag = substr($tag, 0, 64); + return $tag; } function common_valid_profile_tag($str) -- 2.39.5