Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443205
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443205
Commits
5ad7fe32
Verified
Commit
5ad7fe32
authored
5 years ago
by
Lee Rowlands
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3048707
by Daniel Korte, Lendude: Views AJAX arguments are not HTML decoded
parent
80c97af9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/views/src/Controller/ViewAjaxController.php
+2
-1
2 additions, 1 deletion
core/modules/views/src/Controller/ViewAjaxController.php
core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
+20
-0
20 additions, 0 deletions
...iews/tests/src/Unit/Controller/ViewAjaxControllerTest.php
with
22 additions
and
1 deletion
core/modules/views/src/Controller/ViewAjaxController.php
+
2
−
1
View file @
5ad7fe32
...
...
@@ -2,6 +2,7 @@
namespace
Drupal\views\Controller
;
use
Drupal\Component\Utility\Html
;
use
Drupal\Component\Utility\UrlHelper
;
use
Drupal\Core\Ajax\ReplaceCommand
;
use
Drupal\Core\DependencyInjection\ContainerInjectionInterface
;
...
...
@@ -113,7 +114,7 @@ public function ajaxView(Request $request) {
$name
=
$request
->
request
->
get
(
'view_name'
);
$display_id
=
$request
->
request
->
get
(
'view_display_id'
);
if
(
isset
(
$name
)
&&
isset
(
$display_id
))
{
$args
=
$request
->
request
->
get
(
'view_args'
);
$args
=
Html
::
decodeEntities
(
$request
->
request
->
get
(
'view_args'
)
)
;
$args
=
isset
(
$args
)
&&
$args
!==
''
?
explode
(
'/'
,
$args
)
:
[];
// Arguments can be empty, make sure they are passed on as NULL so that
...
...
This diff is collapsed.
Click to expand it.
core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
+
20
−
0
View file @
5ad7fe32
...
...
@@ -260,6 +260,26 @@ public function testAjaxViewWithEmptyArguments() {
$this
->
assertViewResultCommand
(
$response
);
}
/**
* Tests a valid view with arguments.
*/
public
function
testAjaxViewWithHtmlEntityArguments
()
{
$request
=
new
Request
();
$request
->
request
->
set
(
'view_name'
,
'test_view'
);
$request
->
request
->
set
(
'view_display_id'
,
'page_1'
);
$request
->
request
->
set
(
'view_args'
,
'arg1 & arg2/arg3'
);
list
(
$view
,
$executable
)
=
$this
->
setupValidMocks
();
$executable
->
expects
(
$this
->
once
())
->
method
(
'preview'
)
->
with
(
'page_1'
,
[
'arg1 & arg2'
,
'arg3'
]);
$response
=
$this
->
viewAjaxController
->
ajaxView
(
$request
);
$this
->
assertTrue
(
$response
instanceof
ViewAjaxResponse
);
$this
->
assertViewResultCommand
(
$response
);
}
/**
* Tests a valid view with a pager.
*/
...
...
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