Project

General

Profile

Actions

Bug #62307

closed

RteFileLinksUpdateWizard.php only handles spaces, no other 'special' characters

Added by Joachim no-lastname-given over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Install Tool
Target version:
-
Start date:
2014-10-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

This is related, but not the same as Bug #58898. This change fixes an error that goes like <<... not found in referenced element (uid: ...). Reference index was probably out of date.>>

I have a rather big and fairly old instance and some file-links to files with umlauts / accents in my RTE Content. The filename part has apparently been rawurlencoded.

I can reproduce this in 4.7.19 by just linking a text in RTE to a file with umlaut, blockquote or accented character. The result looks like this:

example content 1: ...<link fileadmin/www/bla/Aktionen/file%5B1%5D.pdf>linked text</link>...

example content 2: ...<link fileadmin/bla/blub/pdf/Medien/2010/20100205%20Artikel%20-%20Verkehrsl%C3%A4rm%20hilft%20Steuern%20zu%20sparen%20-%20Landbote.pdf _blank><br>Verkehrslärm hilft Steuern zu sparen</link>......

I tested this with and without the config setting
[SYS][UTF8filesystem] = 1
[SYS][systemLocale] = de_CH
[SYS][systemLocale] = de_CH.utf8

The links that are generated as in example 1 and 2 work fine in 4.7.19 and in 6.2.5.

However, in the Install Tool, while migrating to FAL, the Upgrade Wizard fails in RteFileLinksUpdateWizard.php

fileadmin/www/bla/Aktionen/file[1].pdf not found in referenced element (uid: 8865 of table tt_content in field bodytext). Reference index was probably out of date.

Reason: The regex built in typo3/sysext/install/Classes/Updates/RteFileLinksUpdateWizard.php only handles spaces, no other special characters:

$regularExpression = '$<((link|LINK) ' . str_replace(' ', '%20', $reference['ref_string']) . ').*>$';

If I change the file part of the regex by its rawurlencoded value, then the migration works fine and the links get rewritten and work.

A little catch: $reference['ref_string'] contains the entire path, so rawurlencode also translates slashes to %2F. This can be handled the way we handled whitespace before, str_replacing it back.

Change at Line 197
1: old, 2: rawurlencode:
1 $regularExpression = '$<((link|LINK) ' . str_replace(' ', '%20', $reference['ref_string']) . ').*>$';
2 $regularExpression = '$<((link|LINK) ' . str_replace('%2F', '/', rawurlencode($reference['ref_string'])) . ').*>$';

This creates these expressions:

expression 1: $<((link|LINK) fileadmin/www/bla/Aktionen/file[1].pdf).*>$
expression 2: $<((link|LINK) fileadmin/www/bla/Aktionen/file%5B1%5D.pdf).*>$

expression 1:

$<((link|LINK) fileadmin/bla/blub/pdf/Medien/2010/20100205%20Artikel%20-%20Verkehrslärm%20hilft%20Steuern%20zu%20sparen%20-%20Landbote.pdf).*>$

expression 2:

$<((link|LINK) fileadmin/bla/blub/pdf/Medien/2010/20100205%20Artikel%20-%20Verkehrsl%C3%A4rm%20hilft%20Steuern%20zu%20sparen%20-%20Landbote.pdf).*>$

After that, using expression 2, the Upgrade Wizard works fine for me.


Files

patch_62307.diff (816 Bytes) patch_62307.diff Joachim no-lastname-given, 2014-10-17 14:38

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #58898: Install tool migration step to convert file links fails with exceptionClosed2014-05-18

Actions
Is duplicate of TYPO3 Core - Bug #59133: Error while converting RTE enabled fields to FALClosed2014-05-27

Actions
Actions #1

Updated by Joachim no-lastname-given over 9 years ago

a minipatch for that...

Actions #2

Updated by Helmut Hummel over 9 years ago

  • Status changed from New to Closed

Thanks for the patch. I can confirm that it solves the issue.

Can you push a change request to our review system? (see: http://wiki.typo3.org/Contribution_Walkthrough_Tutorials)

Please reference #59133 in the commit message, as I'm going to close this as duplicate.

Thanks a lot!

Actions

Also available in: Atom PDF