Bug #44440

Setting an external link with domain of the backend leads to exception

Added by Helmut Hummel over 9 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2013-01-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
Tags:
Complexity:
hard
Is Regression:
Sprint Focus:

Description

Asuming the website is running on http://domain.tld and the user is logged into the backend on the same domain. When now putting a link as external URL in the link picker e.g. http://domain.tld/en/home.html
rte cuts off the domain when saving the element. Now the element is not editable any more
because during loading, the URL en/home.html is considered to be a file
which leads to an Exception

TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException 
TYPO3\CMS\Core\Resource\Driver\AbstractDriver::getFile("de/ueber-uns/geschichte.html")

The question now is: how to deal with that?


Files

44440.patch (1.01 KB) 44440.patch Marc Bastian Heinrichs, 2013-02-19 19:50

Related issues

Related to TYPO3 Core - Bug #45490: Problem with blank spaces in data/folder namesClosed2013-02-14

Actions
Related to TYPO3 Core - Bug #46785: FileDoesNotExistException ClosedAlexander Opitz2013-03-29

Actions
#1

Updated by Helmut Hummel over 9 years ago

  • Status changed from New to Accepted
#2

Updated by Steffen Liebig over 9 years ago

I noticed a similar bug - don't know if it's the same one but looks comparable:

First of all, I had problems trying to edit text elements via Page/List. I got "Oops, an error occured" without any explanation. Enabling BE/Debug and changing ProductionExceptionHandler to DebugExceptionHandler (display errors -1 -> 1) threw errors in a few php-files:

TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException thrown in file

/home/www/typo3/typo3/sysext/core/Classes/Resource/Driver/AbstractDriver.php in line 399

together with problems in RTE, FormEngine.php, EditDocumentController.php and alt_doc.php.

Disabling the RTE made it possible to take a look at the code. Correcting the links (deleting the numbers which were given to the file names while moving the site from 4.7.2 to 6.0.0/6.0.1) made it possible to reach the element via RTE again, BUT:

- other subpages throw similar mistakes...checking the code showed that the links are ok in the BE while in FE (mouseover), they get cut off seemingly ALL AT THE SAME POINT. It seemed to be a blank space in the data name causing the trouble, but thats not the crucial point. I replaced it by "_" in the links and in the name of the data folder without success: it lead to the same mistake AFTER the "_"

Assuming: it doesn't seem to matter whether I add the "_" or not - the mistake stays the same, the links are cut off somewhere between BE (RTE ?!) and FE which means they aren't usable anymore.

I just can join Helmut's question: "How to deal with it ?"

#3

Updated by Marc Bastian Heinrichs over 9 years ago

Fixed this for now with attached patch

#4

Updated by Henrik Ziegenhain over 9 years ago

There’s a simular issue with blank spaces in filenames/foldernames in #46007.
The patch from Marc Bastian Heinrichs solves my problem. Thanks.

Could we get this into 6.0.3?

#5

Updated by Thomas Allmer over 9 years ago

Problem still persists in 6.0.4 and won't let you insert any links (to the current domain) in any RTE field... even if you edit it in the DB...
and you can't fix or remove the link as when opening the CE it throws the error...

#6

Updated by Henrik Ziegenhain over 9 years ago

As mentioned above, the patch from Marc Bastian Heinrichs solved the issue.

Marc, could you push this to gerrit or how could we get this fixed?

#7

Updated by Thomas Allmer over 9 years ago

thx Marc :)
Patch works just fine :)

I now have it in my Extension tinymce_rte as I have this function "xclassed" anyway...

https://github.com/daKmoR/TYPO3-tinymce_rte/commit/52829f2174520aa989c1897411314de4305773fc

#8

Updated by Stanislas Rolland about 9 years ago

I am not able to reproduce this issue.

The RTE transformation does not cut the domain off an url entered in the "External link" tab of the link dialogue of htmlArea RTE.

#9

Updated by Stanislas Rolland about 9 years ago

  • Status changed from Accepted to Needs Feedback
#10

Updated by Henrik Ziegenhain about 9 years ago

It seems, that is has something to do with (wrong) configuration.
I also can`t reproduce the issue from Helmut on a fresh 6.0.4 and 6.0.5rc1

On another Installtion (updated from 4.5.x to 6.0.4) I can reproduce it.

#11

Updated by Henrik Ziegenhain about 9 years ago

After a little more investigation I found the following:

Adding a link via the "External Tab" worked fine after saving.
Pasting the same link simply into the RTE and saving crashed it and throwed the exception from above.

The following worked fine:
Pasting the link simply into the RTE, switching to HTML-Mode and manually adding 'data-htmlarea-external="1"' the to a-tag worked fine after saving.

The Installation was updated from 4.7x to 6.0.4 (also reproducable with 6.0.5rc1)


On a fresh and clean installation the data-attribute also is not set, but the exception is not thrown after saving.

#12

Updated by Philipp Müller about 9 years ago

The error occurs also if a text with a link will be copy-pasted from the frontend into the editor.

Patch works fine for me, thanks Marc.

You can reproduce the error, if you add the following code in the editor:

<link dead/link/>linktext</link>

I think the patch is much-needed in 6.0.5... It's not justifiable to provoke a fatal error because a simple "wrong" link in a text editor...

#13

Updated by Gerrit Code Review about 9 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20639

#14

Updated by Alexander Opitz about 9 years ago

I fixed this in #46785 for 6.1/6.2 there is a FolderDoesNotExistException thrown.
BTW: There are two lines who we need to catch.

#15

Updated by Thomas Allmer about 9 years ago

it seems that AFTER 6.0.4? we now have two different Exceptions FileDoesNotExistException and FolderDoesNotExistException... so we have to catch them both

I did it like this

} catch(\Exception  $e) {
    if ($e instanceof \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException OR $e instanceof \TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException) {
        // no file or folder - nothing to do
    } else {
        // Rethrow the Exception
        throw $e;
    }
}
#16

Updated by Mikael Conley about 9 years ago

Still broken in 6.0.6. Does anybody writing this code realize how bad this makes TYPO3 look to our clients?

#17

Updated by Stanislas Rolland almost 9 years ago

  • Status changed from Under Review to Resolved
  • Assignee set to Stanislas Rolland

Was fixed in http://forge.typo3.org/issues/46785

Fix will be included in TYPO3 6.0.7.

#18

Updated by Benni Mack almost 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF