[TASK] ResourceViewHelper should always return absolute paths 03/55003/4
authorBenni Mack <benni@typo3.org>
Sat, 9 Dec 2017 19:04:45 +0000 (20:04 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Sat, 9 Dec 2017 22:38:24 +0000 (23:38 +0100)
The ResourceViewHelper had a special handling for returning relative
paths, but should always use getAbsoluteWebPath().

The option "absolute" is there to generate a full URL, so this is no issue at all.

Resolves: #83272
Releases: master
Change-Id: I3705712bf8cc38cc45914e83715b18c268c42bd8
Reviewed-on: https://review.typo3.org/55003
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/fluid/Classes/ViewHelpers/Uri/ResourceViewHelper.php

index 68aee2f..f7d451a 100644 (file)
@@ -68,11 +68,11 @@ class ResourceViewHelper extends AbstractViewHelper
         }
         $uri = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName) . '/Resources/Public/' . $path;
         $uri = GeneralUtility::getFileAbsFileName($uri);
-        $uri = PathUtility::stripPathSitePrefix($uri);
-        if (TYPO3_MODE === 'BE' && $absolute === false && $uri !== false) {
-            $uri = '../' . $uri;
+        if ($absolute === false && $uri !== false) {
+            $uri = PathUtility::getAbsoluteWebPath($uri);
         }
         if ($absolute === true) {
+            $uri = PathUtility::stripPathSitePrefix($uri);
             $uri = $renderingContext->getControllerContext()->getRequest()->getBaseUri() . $uri;
         }
         return $uri;