Bug #87652

SoftReferenceIndex :: TypoLink :: links like "t3:// FileLinks" won't be recognized

Added by Ralph Brugger over 1 year ago. Updated 10 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2019-02-05
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

Our customer has complained about missing references in the file list.

After some debugging, we noticed the following:

We have some extensions which have some input fields as typolinks:

<config type="array">
    <type>input</type>
    <renderType>inputLink</renderType>
    <softref>typolink</softref>
    <size>100</size>
    <max>512</max>
    <eval>trim</eval>
    <fieldControl>
        <linkPopup>
            <options>
                <title>Link</title>
            </options>
        </linkPopup>
    </fieldControl>
</config>

The SoftReferenceIndexer does not recognize those links, so the filelist does show zeros references, and our client startet to delete those files.

The problem is located inside the function

TYPO3\CMS\Core\Database\SoftReferenceIndex::getTypoLinkParts

Old Code:

// Check for FAL link-handler keyword
if ($linkHandlerKeyword === 'file') {
    $finalTagParts['LINK_TYPE'] = 'file';
    $finalTagParts['identifier'] = trim($link_param);
    return $finalTagParts;
}

This will only work for old-syntaxed file links like "file:nnnn" but not for the new syntax "t3://file::".

I've added the followeing code snipped, fot the new syntax file links:

        if ($linkHandlerKeyword === 't3') {

            // linking to any t3:// syntax
            if (stripos($link_param, 't3://') === 0) {

                // lets parse the urn
                $linkParsed = parse_url($link_param);
                if (isset($linkParsed['host']) && isset($linkParsed['scheme']) && isset($linkParsed['query'])){
                    $identifier = $linkParsed['host'];
                    $scheme = $linkParsed['scheme'];
                    $query = $linkParsed['query'];
                    $finalTagParts['LINK_TYPE'] = $identifier;
                    if($query && $identifier === 'file' ){
                        $queryparts = explode('=', $query);
                        if($queryparts){
                            if(is_array($queryparts)){
                                $queryKey = $queryparts[0];
                                $queryValue = (integer) $queryparts[1];
                                if (is_int($queryValue)){
                                    $finalTagParts['identifier'] = "$identifier:$queryValue";
                                    unset($linkParsed);
                                    unset($queryparts);
                                    return $finalTagParts;
                                }
                            }
                        }
                    }
                }
            }
        }

When saving those records in the backend or when we trigger to rebuild the refindex, those links will now be recognized.

SoftReferenceIndex.php View (35.3 KB) Ralph Brugger, 2019-02-05 09:56


Related issues

Related to TYPO3 Core - Bug #84016: impexp: page links are parsed / replaced incorrectely due to error in SoftReferenceIndex Closed 2018-02-22
Related to TYPO3 Core - Bug #88207: SoftReferenceIndex is missing support for t3://file uri Closed 2019-04-25

Associated revisions

Revision 75aa958b (diff)
Added by Nicole Cordes 12 months ago

[BUGFIX] Streamline SoftReferenceIndex references

This patch streamlines the return values for softref type typoscript and typoscript_tag. Furthermore tests for the API method findRef() are added to ensure same return results.

Furthermore a non-reachable part in findRef_typolink_tag is removed. As the incoming content is split by <a> tags, the <LINK> tag condition within this function will be never fulfilled.

Resolves: #88207
Related: #87652
Releases: master, 9.5
Change-Id: Ifca40c5d0e049c5b5d92a507a9d5ec0249e9953e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62196
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Tested-by: Georg Ringer <>
Reviewed-by: Benni Mack <>
Reviewed-by: Georg Ringer <>

Revision bee275c3 (diff)
Added by Nicole Cordes 12 months ago

[BUGFIX] Streamline SoftReferenceIndex references

This patch streamlines the return values for softref type typoscript and typoscript_tag. Furthermore tests for the API method findRef() are added to ensure same return results.

Furthermore a non-reachable part in findRef_typolink_tag is removed. As the incoming content is split by <a> tags, the <LINK> tag condition within this function will be never fulfilled.

Resolves: #88207
Related: #87652
Releases: master, 9.5
Change-Id: Ifca40c5d0e049c5b5d92a507a9d5ec0249e9953e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62205
Tested-by: TYPO3com <>
Tested-by: Georg Ringer <>
Reviewed-by: Georg Ringer <>

History

#1 Updated by Benni Mack over 1 year ago

  • Category changed from Miscellaneous to Link Handling, Site Handling & Routing

#2 Updated by Benni Mack 12 months ago

  • Related to Bug #84016: impexp: page links are parsed / replaced incorrectely due to error in SoftReferenceIndex added

#3 Updated by Benni Mack 12 months ago

  • Related to Bug #88207: SoftReferenceIndex is missing support for t3://file uri added

#4 Updated by Benni Mack 12 months ago

  • Status changed from New to Resolved

Fixed with issue #84016 - will be released in the next v9 / v10 versions.

#5 Updated by Markus Hackel 11 months ago

Will this fix also be integrated into v8?

#6 Updated by Benni Mack 10 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF