Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
3555e2b4
Commit
3555e2b4
authored
Jul 28, 2015
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2538982
by dawehner, pwolanin, Fabianx: Get rid of strtr in UrlGenerator, it is not needed
parent
5a9f6e7d
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/lib/Drupal/Core/Routing/UrlGenerator.php
+9
-4
9 additions, 4 deletions
core/lib/Drupal/Core/Routing/UrlGenerator.php
with
9 additions
and
4 deletions
core/lib/Drupal/Core/Routing/UrlGenerator.php
+
9
−
4
View file @
3555e2b4
...
...
@@ -54,14 +54,19 @@ class UrlGenerator implements UrlGeneratorInterface {
/**
* Overrides characters that will not be percent-encoded in the path segment.
*
* The first two elements are the first two parameters of str_replace(), so
* if you override this variable you can also use arrays for the encoded
* and decoded characters.
*
* @see \Symfony\Component\Routing\Generator\UrlGenerator
*/
protected
$decodedChars
=
array
(
protected
$decodedChars
=
[
// the slash can be used to designate a hierarchical structure and we want allow using it with this meaning
// some webservers don't allow the slash in encoded form in the path for security reasons anyway
// see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss
'%2F'
=>
'/'
,
);
'%2F'
,
// Map from these encoded characters.
'/'
,
// Map to these decoded characters.
];
/**
* Constructs a new generator object.
...
...
@@ -211,7 +216,7 @@ protected function doGenerate(array $variables, array $defaults, array $tokens,
}
// The contexts base URL is already encoded (see Symfony\Component\HttpFoundation\Request)
$url
=
str
tr
(
rawurlencode
(
$url
),
$this
->
decodedChars
);
$url
=
str
_replace
(
$this
->
decodedChars
[
0
],
$this
->
decodedChars
[
1
],
rawurlencode
(
$url
)
);
// Drupal paths rarely include dots, so skip this processing if possible.
if
(
strpos
(
$url
,
'/.'
)
!==
FALSE
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment