Bug #65482
closedfile:///* links messed up in RTE when saving
0%
Description
RTE interprets file:/// links as FAL file references and cripples them (applies htmlentities encoding and prepends web domain).
Fix
/typo3/sysext/core/Classes/Html/RteHtmlParser.php (line 586), insert:
if(isset($attribArray['href']) && strpos($attribArray['href'], 'file:')===0) $attribArray['rtekeep'] = '1';
This will add an attribute rtekeep="1" to links with schema file: which will in turn keep RTE from touching them.
The inserted rtekeep attribute will not be rendered in FE and only corrects the RTE behaviour.
Updated by Nicole Cordes over 9 years ago
- Status changed from New to Needs Feedback
Can you please clarify your link? Linking to file:// works for me with patches from #65358
Updated by Jörg Wagner over 9 years ago
I rechecked with 6.2.10 and patch set 3 of #65358 applied:
You are right, both versions render out file:// and file:/// links correctly in FE and the links also survive re-opening and re-saving the CE in RTE.
The difference is how the RTE shows those links in HTML mode after re-opening.
Without the above patch, the HTML code is shown very weird (HTTP scheme added, domain added, url-encoded):
<a href="http://www.mydomain.com/?file:%2F%2F%2Fmy%2Fpath%2Fmyfile.pdf" class="external-link-new-window" title="Opens external link in new window">my link text</a>
WITH the above patch the HTML code in RTE is clean:
<a href="file:///my/path/myfile.pdf" class="external-link-new-window" title="Opens external link in new window" data-htmlarea-external="1" rtekeep="1">my link text</a>
A severe problem that I now discovered is that NEITHER of these two versions can be re-opened with the link tool in RTE!
Instead they both result in a popup window with an error page "Oops, an error occurred! File /my/path/myfile.pdf/ does not exist." (I made sure the file DOES exist.)
So editors have no possibility to change existing file:// links.
I will try to nail down this problem and see, whether rtekeep is actually needed to make the link tool work with existing file:// links, or whether it also works with the strangely encoded links that the system currently shows in RTE's HTML mode.
Updated by Nicole Cordes over 9 years ago
I have in RTE:
<p><a href="file://my/path/file.txt" data-htmlarea-external="1">Test</a></p>
The file doesn't exists, but browser pops up without any error. Can you try to recreate the link with the both patches applied?
Updated by Jörg Wagner over 9 years ago
Nicole, I am very sorry for waisting your time.
I did not understand that #65358 contains two patches for branch 6.2. To be honest, even after re-reading the updates I am still confused by the numbering of the patch sets and I could only find all fragments by opening each set and comparing the changed files.
But now I have implemented all changes of that issue into 6.2.10 and I am happy to report that all problems with file:// links in RTE are resolved.
Works like a charm!
Please close this issue.
Sorry again.
Updated by Nicole Cordes over 9 years ago
- Status changed from Needs Feedback to Closed
Dear Jörg,
no problems at all. Glad we solved the issue now!