Skip to content
Snippets Groups Projects
Commit 77009bd9 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch 'hotline#83545_controle_des_url_url_non_traitees' into 'hotline'

hotline #83545 url manager: preg escape urls

See merge request !2953
parents 0d307bda 87b76985
Branches
Tags
3 merge requests!3297WIP: Master,!2971Dev#69586 storypairing inclure des articles dans les newsletters,!2953hotline #83545 url manager: preg escape urls
Pipeline #5932 failed with stage
in 27 minutes and 4 seconds
- ticket #83545 : Contrôle des URLS : corrections de la prise en charge des URLs contenant des caractères spéciaux
\ No newline at end of file
......@@ -45,7 +45,7 @@ class Class_UrlManager extends Class_Entity {
'://'],
'',
$term);
$preg = '@(' . $protocol . '://'. $search_pattern . '*' . $preg_term . $search_pattern . '*)[\b\s]?@i';
$preg = '@(' . $protocol . '://'. $search_pattern . '*' . preg_quote($preg_term) . $search_pattern . '*)[\b\s]?@i';
}
$this
......
......@@ -292,3 +292,27 @@ class UrlManagerControllerAsyncUpdateUrlInModelsActionTest extends UrlManagerTes
$this->assertContains('https', Class_Article::find(78)->getContenu());
}
}
class UrlManagerControllerIndexDispatchUrlWithPlusTest extends UrlManagerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_Article',
['id' => 78,
'titre' => 'Chien et chat',
'description' => 'test de description : http://mon-domain.org',
'contenu' => 'test: http://monurl.fr. http://mon-domain.org/recherche/pommo+d\'api']);
$this->dispatch(sprintf('/admin/url-manager/index/term/%s',
urlencode('http://mon-domain.org/recherche/pommo+d\'api')));
}
/** @test **/
public function tableUrlShouldContainsMonDomainePregEscaped() {
$this->assertXPathContentContains('//table[@id="urls"]//td', 'http://mon-domain.org/recherche/pommo+d\'api');
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment