Skip to content

Commit

Permalink
fix(output): elgg_normalize_url no longer mistakes querystrings for d…
Browse files Browse the repository at this point in the history
…omains

The pattern for recognizing domain names in elgg_normalize_url was too
tolerant, resulting in some paths begin seen as domains just because
the querystring contained a period.
  • Loading branch information
mrclay committed Aug 11, 2014
1 parent 121a153 commit 505d249
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion engine/lib/output.php
Expand Up @@ -324,7 +324,7 @@ function elgg_normalize_url($url) {
// 'install.php', 'install.php?step=step'
return elgg_get_site_url() . $url;

} elseif (preg_match("#^[^/]*\.#i", $url)) {
} elseif (preg_match("#^[^/?]*\.#i", $url)) {
// 'example.com', 'example.com/subpage'
return "http://$url";

Expand Down
1 change: 1 addition & 0 deletions engine/tests/ElggCoreHelpersTest.php
Expand Up @@ -125,6 +125,7 @@ public function testHttpUrlIsIdentical() {
'page/handler?p=v&p2=v2' => elgg_get_site_url() . 'page/handler?p=v&p2=v2',
'mod/plugin/file.php' => elgg_get_site_url() . 'mod/plugin/file.php',
'mod/plugin/file.php?p=v&p2=v2' => elgg_get_site_url() . 'mod/plugin/file.php?p=v&p2=v2',
'search?foo.bar' => elgg_get_site_url() . 'search?foo.bar',
'rootfile.php' => elgg_get_site_url() . 'rootfile.php',
'rootfile.php?p=v&p2=v2' => elgg_get_site_url() . 'rootfile.php?p=v&p2=v2',

Expand Down

0 comments on commit 505d249

Please sign in to comment.