File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/lib/Persistence/Legacy/Content/UrlAlias Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,13 @@ class Handler implements UrlAliasHandlerInterface
4646 */
4747 public const MAX_URL_ALIAS_DEPTH_LEVEL = 60 ;
4848
49+ /**
50+ * Match url alias id in form of `<parentId>-<textMD5>`.
51+ *
52+ * @var string
53+ */
54+ public const URL_ALIAS_ID_PATTERN = '/^\d+-[a-f0-9]{32}$/ ' ;
55+
4956 /**
5057 * UrlAlias Gateway.
5158 *
@@ -620,6 +627,10 @@ public function lookup($url)
620627 */
621628 public function loadUrlAlias ($ id )
622629 {
630+ if (!preg_match (self ::URL_ALIAS_ID_PATTERN , $ id )) {
631+ throw new NotFoundException ('URLAlias ' , $ id );
632+ }
633+
623634 list ($ parentId , $ textMD5 ) = explode ('- ' , $ id );
624635 $ data = $ this ->gateway ->loadRow ((int )$ parentId , $ textMD5 );
625636
You can’t perform that action at this time.
0 commit comments