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
71cf6406
Commit
71cf6406
authored
May 7, 2012
by
Larry Garfield
Browse files
Options
Downloads
Patches
Plain Diff
Automatically urldecode() paths to allow for useful data in path fragments.
parent
2ceb9c02
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/EventSubscriber/PathSubscriber.php
+27
-1
27 additions, 1 deletion
core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
with
27 additions
and
1 deletion
core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
+
27
−
1
View file @
71cf6406
...
...
@@ -68,6 +68,31 @@ public function onKernelRequestFrontPageResolve(GetResponseEvent $event) {
$this
->
setPath
(
$request
,
$path
);
}
/**
* Decodes the path of the request.
*
* Parameters in the URL sometimes represent code-meaningful strings. It is
* therefore useful to always urldecode() those values so that individual
* controllers need not concern themselves with it. This is Drupal-specific
* logic, and may not be familiar for developers used to other Symfony-family
* projects.
*
* @todo Revisit whether or not this logic is appropriate for here or if
* controllers should be required to implement this logic themselves. If
* we decide to keep this code, remove this TODO.
*
* @param GetResponseEvent $event
* The Event to process.
*/
public
function
onKernelRequestDecodePath
(
GetResponseEvent
$event
)
{
$request
=
$event
->
getRequest
();
$path
=
$this
->
extractPath
(
$request
);
$path
=
urldecode
(
$path
);
$this
->
setPath
(
$request
,
$path
);
}
/**
* Registers the methods in this class that should be listeners.
*
...
...
@@ -75,8 +100,9 @@ public function onKernelRequestFrontPageResolve(GetResponseEvent $event) {
* An array of event listener definitions.
*/
static
function
getSubscribedEvents
()
{
$events
[
KernelEvents
::
REQUEST
][]
=
array
(
'onKernelRequest
PathResolve
'
,
10
0
);
$events
[
KernelEvents
::
REQUEST
][]
=
array
(
'onKernelRequest
DecodePath
'
,
10
2
);
$events
[
KernelEvents
::
REQUEST
][]
=
array
(
'onKernelRequestFrontPageResolve'
,
101
);
$events
[
KernelEvents
::
REQUEST
][]
=
array
(
'onKernelRequestPathResolve'
,
100
);
return
$events
;
}
...
...
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
register
or
sign in
to comment