Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
5ad7fe32
Verified
Commit
5ad7fe32
authored
May 24, 2019
by
larowlan
Browse files
Issue
#3048707
by Daniel Korte, Lendude: Views AJAX arguments are not HTML decoded
parent
80c97af9
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/views/src/Controller/ViewAjaxController.php
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
...
...
core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
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.
*/
...
...
larowlan
@larowlan
mentioned in commit
db905bd4
·
May 24, 2019
mentioned in commit
db905bd4
mentioned in commit db905bd451b97185d05d5af62b881c40b020fff7
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment