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
4945bae2
Commit
4945bae2
authored
Apr 13, 2014
by
webchick
Browse files
Issue
#2238945
by effulgentsia: Remove the 'clean_urls' request attribute.
parent
ea22b219
Changes
3
Show whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
View file @
4945bae2
...
...
@@ -50,13 +50,7 @@ public function onKernelRequestConvertPath(GetResponseEvent $event) {
$path
=
trim
(
$request
->
getPathInfo
(),
'/'
);
$path
=
$this
->
pathProcessor
->
processInbound
(
$path
,
$request
);
$request
->
attributes
->
set
(
'_system_path'
,
$path
);
// Also set an attribute that indicates whether we are using clean URLs.
$clean_urls
=
TRUE
;
$base_url
=
$request
->
getBaseUrl
();
if
(
!
empty
(
$base_url
)
&&
strpos
(
$base_url
,
$request
->
getScriptName
())
!==
FALSE
)
{
$clean_urls
=
FALSE
;
}
$request
->
attributes
->
set
(
'clean_urls'
,
$clean_urls
);
// Set the cache key on the alias manager cache decorator.
if
(
$event
->
getRequestType
()
==
HttpKernelInterface
::
MASTER_REQUEST
)
{
$this
->
aliasManager
->
setCacheKey
(
$path
);
...
...
core/lib/Drupal/Core/Routing/RequestHelper.php
View file @
4945bae2
...
...
@@ -128,4 +128,25 @@ public static function duplicate(Request $original_request, $uri, $method = 'GET
return
$request
;
}
/**
* Returns whether the request is using a clean URL.
*
* A clean URL is one that does not include the script name. For example,
* - http://example.com/node/1 is a clean URL.
* - http://example.com/index.php/node/1 is not a clean URL.
*
* Unclean URLs are required on sites hosted by web servers that cannot be
* configured to implicitly route URLs to index.php.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request.
*
* @return bool
* TRUE if the request is using a clean URL.
*/
public
static
function
isCleanUrl
(
Request
$request
)
{
$base_url
=
$request
->
getBaseUrl
();
return
(
empty
(
$base_url
)
||
strpos
(
$base_url
,
$request
->
getScriptName
())
===
FALSE
);
}
}
core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
View file @
4945bae2
...
...
@@ -10,6 +10,7 @@
use
Drupal\Core\Config\Entity\ConfigEntityBase
;
use
Drupal\Core\Config\Entity\EntityWithPluginBagInterface
;
use
Drupal\Core\Entity\EntityStorageInterface
;
use
Drupal\Core\Routing\RequestHelper
;
use
Drupal\image\ImageEffectBag
;
use
Drupal\image\ImageEffectInterface
;
use
Drupal\image\ImageStyleInterface
;
...
...
@@ -208,7 +209,7 @@ public function buildUrl($path, $clean_urls = NULL) {
$clean_urls
=
TRUE
;
try
{
$request
=
\
Drupal
::
request
();
$clean_urls
=
$r
equest
->
attributes
->
get
(
'clean_urls'
);
$clean_urls
=
R
equest
Helper
::
isCleanUrl
(
$request
);
}
catch
(
ServiceNotFoundException
$e
)
{
}
...
...
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