Skip to content

Commit

Permalink
[BUGFIX] Remove $scheme from LegacyLinkNotationConverter::resolve()
Browse files Browse the repository at this point in the history
The code block using $scheme is never reached, because there is already
an elseif condition further above, that is true for all urls containing
":".

The last else block even states in the comment:
"special handling without a scheme"

Therefore the variable is removed to remove a bit of complexity from the
function.

Resolves: #90951
Releases: master, 9.5
Change-Id: I2bc9fe0c546cb946fc32789ee384c3c60ac7c1fa
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64077
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
  • Loading branch information
IndyIndyIndy authored and georgringer committed Apr 21, 2020
1 parent 2c2e231 commit dead9a1
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public function resolve(string $linkParameter): array
}

$result = [];
// Parse URL scheme
$scheme = parse_url($linkParameter, PHP_URL_SCHEME);

// Resolve FAL-api "file:UID-of-sys_file-record" and "file:combined-identifier"
if (stripos($linkParameter, 'file:') === 0) {
Expand Down Expand Up @@ -137,12 +135,8 @@ public function resolve(string $linkParameter): array
// url (external): If doubleSlash or if a '.' comes before a '/'.
if (!$isIdOrAlias && $isLocalFile !== 1 && $urlChar && (!$containsSlash || $urlChar < $fileChar)) {
$result['type'] = LinkService::TYPE_URL;
if (!$scheme) {
$result['url'] = 'http://' . $linkParameter;
} else {
$result['url'] = $linkParameter;
}
// file (internal) or folder
$result['url'] = 'http://' . $linkParameter;
// file (internal) or folder
} elseif ($containsSlash || $isLocalFile) {
$result = $this->getFileOrFolderObjectFromMixedIdentifier($linkParameter);
} else {
Expand Down

0 comments on commit dead9a1

Please sign in to comment.