+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/MVC/Symfony/SiteAccess/Matcher/HostText.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(array $siteAccessesConfiguration)
$this->prefix = isset($siteAccessesConfiguration['prefix']) ? $siteAccessesConfiguration['prefix'] : '';
$this->suffix = isset($siteAccessesConfiguration['suffix']) ? $siteAccessesConfiguration['suffix'] : '';
parent::__construct(
'^' . preg_quote($this->prefix, '@') . "(\w+)" . preg_quote($this->suffix, '@') . '$',
'^' . preg_quote($this->prefix, '@') . "([\w-]+)" . preg_quote($this->suffix, '@') . '$',
1
);
$this->siteAccessesConfiguration = $siteAccessesConfiguration;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/MVC/Symfony/SiteAccess/Matcher/URIText.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(array $siteAccessesConfiguration)
$this->suffix = isset($siteAccessesConfiguration['suffix']) ? $siteAccessesConfiguration['suffix'] : '';

parent::__construct(
'^(/' . preg_quote($this->prefix, '@') . '(\w+)' . preg_quote($this->suffix, '@') . ')',
'^(/' . preg_quote($this->prefix, '@') . '([\w-]+)' . preg_quote($this->suffix, '@') . ')',
2
);
$this->siteAccessesConfiguration = $siteAccessesConfiguration;
Expand Down
6 changes: 6 additions & 0 deletions tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function matchProvider(): array
[SimplifiedRequest::fromUrl('http://example.com/test/foo/bar/'), 'default_sa'],
[SimplifiedRequest::fromUrl('http://example.com/test/foo/bar/first_sa'), 'default_sa'],
[SimplifiedRequest::fromUrl('http://example.com/default_sa'), 'default_sa'],
[SimplifiedRequest::fromUrl('http://example.com/sa-with-hyphen'), 'sa-with-hyphen'],

[SimplifiedRequest::fromUrl('http://example.com/first_sa'), 'first_sa'],
[SimplifiedRequest::fromUrl('http://example.com/first_sa/'), 'first_sa'],
Expand All @@ -58,6 +59,7 @@ public function matchProvider(): array
[SimplifiedRequest::fromUrl('http://www.example.com:82/'), 'example'],
[SimplifiedRequest::fromUrl('https://www.example.com:83/'), 'example'],
[SimplifiedRequest::fromUrl('http://www.example.com/foo/'), 'example'],
[SimplifiedRequest::fromUrl('http://www.sa-with-hyphen.com'), 'sa-with-hyphen'],

[SimplifiedRequest::fromUrl('http://example.com/second_sa'), 'second_sa'],
[SimplifiedRequest::fromUrl('http://example.com/second_sa/'), 'second_sa'],
Expand Down Expand Up @@ -108,10 +110,12 @@ protected function createRouter(): Router
'Map\\URI' => [
'first_sa' => 'first_sa',
'second_sa' => 'second_sa',
'sa-with-hyphen' => 'sa-with-hyphen',
],
'Map\\Host' => [
'first_sa' => 'first_sa',
'first_siteaccess' => 'first_sa',
'sa-with-hyphen' => 'sa-with-hyphen',
],
],
$this->siteAccessProvider
Expand All @@ -131,6 +135,8 @@ public function getSiteAccessProviderSettings(): array
new SiteAccessSetting('fifth_sa', true),
new SiteAccessSetting('example', true),
new SiteAccessSetting(self::DEFAULT_SA_NAME, true),
new SiteAccessSetting('fifth_sa', true),
new SiteAccessSetting('sa-with-hyphen', true),
];
}
}
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载