Commit 9d050abb authored by catch's avatar catch

Issue #2643274 by swentel, Mac_Weber, amateescu: EntityAutocomplete does not...

Issue #2643274 by swentel, Mac_Weber, amateescu: EntityAutocomplete does not recognize URLs ending with a parenthesis
parent 340daaf7
......@@ -330,11 +330,11 @@ public static function extractEntityIdFromAutocompleteInput($input) {
// Take "label (entity id)', match the ID from parenthesis when it's a
// number.
if (preg_match("/.+\((\d+)\)/", $input, $matches)) {
if (preg_match("/.+\s\((\d+)\)/", $input, $matches)) {
$match = $matches[1];
}
// Match the ID when it's a string (e.g. for config entity types).
elseif (preg_match("/.+\(([\w.]+)\)/", $input, $matches)) {
elseif (preg_match("/.+\s\(([\w.]+)\)/", $input, $matches)) {
$match = $matches[1];
}
......
......@@ -164,7 +164,7 @@ protected function doTestAuthoringInfo() {
'created' => REQUEST_TIME - mt_rand(0, 1000),
);
$edit = array(
'uid' => $user->getUsername() . '(' . $user->id() . ')',
'uid' => $user->getUsername() . ' (' . $user->id() . ')',
'date[date]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d'),
'date[time]' => format_date($values[$langcode]['created'], 'custom', 'H:i:s'),
);
......
......@@ -308,7 +308,7 @@ public function testFieldAdminHandler() {
$edit = array(
'title[0][value]' => 'Test',
'field_test_entity_ref_field[0][target_id]' => $node1->getTitle() . '(' . $node1->id() . ')'
'field_test_entity_ref_field[0][target_id]' => $node1->getTitle() . ' (' . $node1->id() . ')'
);
$this->drupalPostForm('node/add/' . $this->type, $edit, t('Save'));
$this->assertLink($node1->getTitle());
......
......@@ -101,6 +101,10 @@ function testURLValidation() {
// strings displayed to the user).
$valid_external_entries = array(
'http://www.example.com/' => 'http://www.example.com/',
// Strings within parenthesis without leading space char.
'http://www.example.com/strings_(string_within_parenthesis)' => 'http://www.example.com/strings_(string_within_parenthesis)',
// Numbers within parenthesis without leading space char.
'http://www.example.com/numbers_(9999)' => 'http://www.example.com/numbers_(9999)',
);
$valid_internal_entries = array(
'/entity_test/add' => '/entity_test/add',
......
Markdown is supported
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