Unverified Commit b98cdcad authored by alexpott's avatar alexpott

Issue #2927723 by longwave, artreaktor, chiranjeeb2410, ankitjain28may,...

Issue #2927723 by longwave, artreaktor, chiranjeeb2410, ankitjain28may, cilefen, dawehner: The URL "/ " with trailing space is not getting recognized as <front>
parent 4a03584d
......@@ -101,7 +101,7 @@ protected static function getUriAsDisplayableString($uri) {
*/
protected static function getUserEnteredStringAsUri($string) {
// By default, assume the entered string is an URI.
$uri = $string;
$uri = trim($string);
// Detect entity autocomplete string, map to 'entity:' URI.
$entity_id = EntityAutocomplete::extractEntityIdFromAutocompleteInput($string);
......
......@@ -121,6 +121,10 @@ public function testURLValidation() {
'/?example=llama' => '&lt;front&gt;?example=llama',
'/#example' => '&lt;front&gt;#example',
// Trailing spaces should be ignored.
'/ ' => '&lt;front&gt;',
'/path with spaces ' => '/path with spaces',
// @todo '<front>' is valid input for BC reasons, may be removed by
// https://www.drupal.org/node/2421941
'<front>' => '&lt;front&gt;',
......@@ -200,7 +204,7 @@ protected function assertValidEntries($field_name, array $valid_entries) {
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
$this->assertRaw($string);
$this->assertRaw('"' . $string . '"');
}
}
......
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