diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index a49c3d3b3e..4fd89304f3 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -549,8 +549,8 @@ class acp_board
}
}
- // Invalidate the text_formatter cache when posting options are changed
- if ($mode == 'post' && $submit)
+ // Invalidate the text_formatter cache when posting or server options are changed
+ if (preg_match('(^(?:post|server)$)', $mode) && $submit)
{
$phpbb_container->get('text_formatter.cache')->invalidate();
}
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index f82c7b0771..e97b4feb85 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -470,11 +470,17 @@ class factory implements \phpbb\textformatter\cache_interface
$tag->attributes->add('text');
$tag->template = '';
+ $board_url = generate_board_url() . '/';
$tag->filterChain
->add(array($this->link_helper, 'truncate_local_url'))
->resetParameters()
->addParameterByName('tag')
- ->addParameterByValue(generate_board_url() . '/');
+ ->addParameterByValue($board_url);
+ $tag->filterChain
+ ->add(array($this->link_helper, 'truncate_local_url'))
+ ->resetParameters()
+ ->addParameterByName('tag')
+ ->addParameterByValue(preg_replace('(^\\w+:)', '', $board_url));
$tag->filterChain
->add(array($this->link_helper, 'truncate_text'))
->resetParameters()
diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php
index ce15a52adc..157af196d9 100644
--- a/tests/text_formatter/s9e/default_formatting_test.php
+++ b/tests/text_formatter/s9e/default_formatting_test.php
@@ -257,6 +257,10 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case
'[url=http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[/url]',
'http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
),
+ array(
+ '[url]//localhost/phpbb/viewforum.php?f=1[/url]',
+ 'viewforum.php?f=1'
+ ),
array(
'[quote="[url=http://example.org]xxx[/url]"]...[/quote]',
'
'