Browse Source

update namespace regex

main
ghost 11 months ago
parent
commit
a04a493ac3
  1. 2
      src/Controller/ModuleController.php
  2. 4
      src/Controller/RoomController.php
  3. 2
      src/Twig/AppExtension.php

2
src/Controller/ModuleController.php

@ -108,7 +108,7 @@ class ModuleController extends AbstractController
} }
// Append custom valid namespace to the rooms list menu // Append custom valid namespace to the rooms list menu
if (!in_array($request->get('namespace'), $list) && preg_match('/^[A-z0-9]{34}$/', $request->get('namespace'))) if (!in_array($request->get('namespace'), $list) && preg_match('/^N[A-z0-9]{33}$/', $request->get('namespace')))
{ {
$list[] = $request->get('namespace'); $list[] = $request->get('namespace');
} }

4
src/Controller/RoomController.php

@ -136,7 +136,7 @@ class RoomController extends AbstractController
name: 'room_namespace', name: 'room_namespace',
requirements: requirements:
[ [
'namespace' => '^[A-z0-9]{34}$', 'namespace' => '^N[A-z0-9]{33}$',
'txid' => '^[A-z0-9]{64}$', 'txid' => '^[A-z0-9]{64}$',
], ],
defaults: defaults:
@ -298,7 +298,7 @@ class RoomController extends AbstractController
name: 'room_post', name: 'room_post',
requirements: requirements:
[ [
'namespace' => '^[A-z0-9]{34}$', 'namespace' => '^N[A-z0-9]{33}$',
], ],
methods: methods:
[ [

2
src/Twig/AppExtension.php

@ -185,7 +185,7 @@ class AppExtension extends AbstractExtension
): string ): string
{ {
// Validate namespace supported to continue // Validate namespace supported to continue
if (!preg_match('/^[A-z0-9]{34}$/', $namespace)) if (!preg_match('/^N[A-z0-9]{33}$/', $namespace))
{ {
return $namespace; return $namespace;
} }

Loading…
Cancel
Save