From 55ea8a6912e1ff7e1587e9d684cdfbad63174d14 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 2 Dec 2020 12:00:05 +0100 Subject: [PATCH 1/3] #896 Added support for unicode characters in custom slugs --- module/Core/functions/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/Core/functions/functions.php b/module/Core/functions/functions.php index 2f7f86e9..6c82cbc7 100644 --- a/module/Core/functions/functions.php +++ b/module/Core/functions/functions.php @@ -18,7 +18,7 @@ const MIN_SHORT_CODES_LENGTH = 4; const DEFAULT_REDIRECT_STATUS_CODE = StatusCodeInterface::STATUS_FOUND; const DEFAULT_REDIRECT_CACHE_LIFETIME = 30; const LOCAL_LOCK_FACTORY = 'Shlinkio\Shlink\LocalLockFactory'; -const CUSTOM_SLUGS_REGEXP = '/[^A-Za-z0-9._~]+/'; +const CUSTOM_SLUGS_REGEXP = '/[^\pL\pN._~]/u'; // Any unicode word or number, plus ".", "_" and "~" chars function generateRandomShortCode(int $length): string { From 6e9fa6553d137c7e165845f2343bf8db191116d7 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 2 Dec 2020 12:01:35 +0100 Subject: [PATCH 2/3] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24bd6df0..11690ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this It can be provided during the installation, or as the `DB_UNIX_SOCKET` env var for the docker image. +* [#896](https://github.com/shlinkio/shlink/issues/896) Added support for unicode characters in custom slugs. + ### Changed * [#912](https://github.com/shlinkio/shlink/issues/912) Changed error templates to be plain html files, removing the dependency on `league/plates` package. From 7ac1c32ad6b890a7c8360e4b458e116840d7eb3a Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 2 Dec 2020 12:02:49 +0100 Subject: [PATCH 3/3] Fixed typo --- module/Core/functions/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/Core/functions/functions.php b/module/Core/functions/functions.php index 6c82cbc7..6ae232be 100644 --- a/module/Core/functions/functions.php +++ b/module/Core/functions/functions.php @@ -18,7 +18,7 @@ const MIN_SHORT_CODES_LENGTH = 4; const DEFAULT_REDIRECT_STATUS_CODE = StatusCodeInterface::STATUS_FOUND; const DEFAULT_REDIRECT_CACHE_LIFETIME = 30; const LOCAL_LOCK_FACTORY = 'Shlinkio\Shlink\LocalLockFactory'; -const CUSTOM_SLUGS_REGEXP = '/[^\pL\pN._~]/u'; // Any unicode word or number, plus ".", "_" and "~" chars +const CUSTOM_SLUGS_REGEXP = '/[^\pL\pN._~]/u'; // Any unicode letter or number, plus ".", "_" and "~" chars function generateRandomShortCode(int $length): string {